winpthreads: mutex.c: refactor implementation
For each mutex type supported by the implementation, move logic for each basic
operation to a separate function:
- It reduces amount of runtime checks
- It makes it easier to follow interaction between functions implementing
basic operations for a specific mutex type
There is now a separate `Winpthreads{Type}Mutex` structure for each mutex type
supported by the implementation.
Structure `WinpthreadsMutex`, which is pointed to by `pthread_mutex_t` objects,
now is an union of mutex-type-specific `Winpthreads{Type}Mutex` structures.
The real allocation size of `WinpthreadsMutex` structure is the same as for
`Winpthreads{Type}Mutex` structure for a specific mutex type; this allows us to
allocate only as much memory as required to implement specific mutex type.
Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com>
Co-authored-by: LIU Hao <lh_mouse@126.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
1 file changed