summaryrefslogtreecommitdiffstats
path: root/osdep/win32/include/pthread.h
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/win32/include/pthread.h')
-rw-r--r--osdep/win32/include/pthread.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/osdep/win32/include/pthread.h b/osdep/win32/include/pthread.h
index 7b82eb2651..e1324a0bb0 100644
--- a/osdep/win32/include/pthread.h
+++ b/osdep/win32/include/pthread.h
@@ -25,19 +25,21 @@
int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
typedef struct {
- char static_mutex;
- INIT_ONCE static_init;
- CRITICAL_SECTION cs;
+ char use_cs;
+ union {
+ SRWLOCK srw;
+ CRITICAL_SECTION cs;
+ } lock;
} pthread_mutex_t;
-#define PTHREAD_MUTEX_INITIALIZER {1, INIT_ONCE_STATIC_INIT}
+// Assume SRWLOCK_INIT is {0} so we can easily remain C89-compatible.
+#define PTHREAD_MUTEX_INITIALIZER {0}
#define pthread_mutexattr_t int
#define pthread_mutexattr_destroy(attr) (void)0
#define pthread_mutexattr_init(attr) (*(attr) = 0)
-#define pthread_mutexattr_settype(attr, type) (void)0
-// CRITICAL_SECTION is always recursive
-#define PTHREAD_MUTEX_RECURSIVE 0
+#define pthread_mutexattr_settype(attr, type) (*(attr) = (type))
+#define PTHREAD_MUTEX_RECURSIVE 1
int pthread_mutex_destroy(pthread_mutex_t *mutex);
int pthread_mutex_init(pthread_mutex_t *restrict mutex,