diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/compat/pthread.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/compat/pthread.h b/include/compat/pthread.h index 861c8e1..8b8c3c6 100644 --- a/include/compat/pthread.h +++ b/include/compat/pthread.h | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | * pthread.h compatibility shim | 3 | * pthread.h compatibility shim |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #ifndef LIBCRYPTOCOMPAT_PTHREAD_H | ||
| 7 | #define LIBCRYPTOCOMPAT_PTHREAD_H | ||
| 8 | |||
| 6 | #ifdef _WIN32 | 9 | #ifdef _WIN32 |
| 7 | 10 | ||
| 8 | #include <windows.h> | 11 | #include <windows.h> |
| @@ -52,6 +55,32 @@ pthread_equal(pthread_t t1, pthread_t t2) | |||
| 52 | return t1 == t2; | 55 | return t1 == t2; |
| 53 | } | 56 | } |
| 54 | 57 | ||
| 58 | typedef CRITICAL_SECTION pthread_mutex_t; | ||
| 59 | typedef void pthread_mutexattr_t; | ||
| 60 | |||
| 61 | static inline int | ||
| 62 | pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) | ||
| 63 | { | ||
| 64 | InitializeCriticalSection(mutex); | ||
| 65 | return 0; | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline int | ||
| 69 | pthread_mutex_lock(pthread_mutex_t *mutex) | ||
| 70 | { | ||
| 71 | EnterCriticalSection(mutex); | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | |||
| 75 | static inline int | ||
| 76 | pthread_mutex_unlock(pthread_mutex_t *mutex) | ||
| 77 | { | ||
| 78 | LeaveCriticalSection(mutex); | ||
| 79 | return 0; | ||
| 80 | } | ||
| 81 | |||
| 55 | #else | 82 | #else |
| 56 | #include_next <pthread.h> | 83 | #include_next <pthread.h> |
| 57 | #endif | 84 | #endif |
| 85 | |||
| 86 | #endif | ||
