winpthreads: mutex.c: implement robust mutexes
Implementation for robust (`PTHREAD_MUTEX_ROBUST`) mutexes is based directly
on Windows mutexes.
Unlike stalled (`PTHREAD_MUTEX_STALLED`) mutexes, robust mutexes lack fast lock
paths and always require call to `WaitForSingleObject`, which may result in
a very noticable overhead in certain cases.
Add tests for robust mutexes. New tests correspond to those for stalled mutexes;
there are two new subtests specific to robust mutexes:
- robust-*-state-recoverable
- robust-*-state-unrecoverable
These tests verify that robust mutexes properly handle cases when a thread
which owned the mutex terminated without releasing it.
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>
27 files changed