diff options
author | alexey.lysiuk <[email protected]> | 2018-10-15 16:40:57 +0000 |
---|---|---|
committer | alexey.lysiuk <[email protected]> | 2018-10-15 19:41:22 +0300 |
commit | c8d866a25aa0499fa084074ebdc59c24ef9f2449 (patch) | |
tree | 07f99ceda1c72f7097023c0b3ed11e5596fbf824 /common/threads.h | |
parent | 6761218e51699f46bf25c377e65b3e9ea5e434b9 (diff) |
Use GCD semaphore on macOS
Unnamed POSIX semaphore doesn't work on macOS
Diffstat (limited to 'common/threads.h')
-rw-r--r-- | common/threads.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/threads.h b/common/threads.h index b0bebd8d..2d1b4e7f 100644 --- a/common/threads.h +++ b/common/threads.h @@ -130,13 +130,21 @@ inline int altss_set(altss_t tss_id, void *val) #include <stdint.h> #include <errno.h> #include <pthread.h> +#ifdef __APPLE__ +#include <dispatch/dispatch.h> +#else /* !__APPLE__ */ #include <semaphore.h> +#endif /* __APPLE__ */ typedef pthread_t althrd_t; typedef pthread_mutex_t almtx_t; typedef pthread_cond_t alcnd_t; +#ifdef __APPLE__ +typedef dispatch_semaphore_t alsem_t; +#else /* !__APPLE__ */ typedef sem_t alsem_t; +#endif /* __APPLE__ */ typedef pthread_key_t altss_t; typedef pthread_once_t alonce_flag; |