5 #include <AvailabilityMacros.h>
6 #include <TargetConditionals.h>
7 #if (((MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__)) || TARGET_OS_IOS || TARGET_OS_TV)
8 #include <dispatch/dispatch.h>
9 #define AL_APPLE_HAVE_DISPATCH 1
11 #include <semaphore.h> /* Fallback option for Apple without a working libdispatch */
13 #elif !defined(_WIN32)
14 #include <semaphore.h>
21 using native_type
= void*;
22 #elif defined(AL_APPLE_HAVE_DISPATCH)
23 using native_type
= dispatch_semaphore_t
;
25 using native_type
= sem_t
;
30 semaphore(unsigned int initial
=0);
31 semaphore(const semaphore
&) = delete;
34 semaphore
& operator=(const semaphore
&) = delete;
38 bool try_wait() noexcept
;
43 #endif /* COMMON_ALSEM_H */