summaryrefslogtreecommitdiffstats
path: root/osdep/win32/include/pthread.h
diff options
context:
space:
mode:
authorMartin Herkt <lachs0r@srsfckn.biz>2016-06-25 02:25:44 +0200
committerMartin Herkt <lachs0r@srsfckn.biz>2016-06-25 02:25:44 +0200
commitad56f2c46ac6deec86870ec10f2a11a644df07d4 (patch)
tree89f2d90c5586560911e67c872b530c77f151168d /osdep/win32/include/pthread.h
parent0536841647ef7931bffb4386d8ffbb5b2b568e8a (diff)
parent393bb2a565dc1e27812e1dd20747814892f80da2 (diff)
downloadmpv-ad56f2c46ac6deec86870ec10f2a11a644df07d4.tar.bz2
mpv-ad56f2c46ac6deec86870ec10f2a11a644df07d4.tar.xz
Merge branch 'master' into release/current
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,