diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2016-06-25 02:25:44 +0200 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2016-06-25 02:25:44 +0200 |
commit | ad56f2c46ac6deec86870ec10f2a11a644df07d4 (patch) | |
tree | 89f2d90c5586560911e67c872b530c77f151168d /osdep/win32/include/pthread.h | |
parent | 0536841647ef7931bffb4386d8ffbb5b2b568e8a (diff) | |
parent | 393bb2a565dc1e27812e1dd20747814892f80da2 (diff) | |
download | mpv-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.h | 16 |
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, |