diff options
Diffstat (limited to 'common/threads.cpp')
-rw-r--r-- | common/threads.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/threads.cpp b/common/threads.cpp index e3b715f0..e847d1f8 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -114,10 +114,10 @@ void althrd_setname(const char *name) void althrd_setname(const char*) { } #endif -namespace al { - #ifdef __APPLE__ +namespace al { + semaphore::semaphore(unsigned int initial) { mSem = dispatch_semaphore_create(initial); @@ -137,10 +137,14 @@ void semaphore::wait() noexcept bool semaphore::try_wait() noexcept { return dispatch_semaphore_wait(mSem, DISPATCH_TIME_NOW) == 0; } +} // namespace al + #else /* !__APPLE__ */ #include <cerrno> +namespace al { + semaphore::semaphore(unsigned int initial) { if(sem_init(&mSem, 0, initial) != 0) @@ -165,8 +169,8 @@ void semaphore::wait() noexcept bool semaphore::try_wait() noexcept { return sem_trywait(&mSem) == 0; } -#endif /* __APPLE__ */ - } // namespace al +#endif /* __APPLE__ */ + #endif /* _WIN32 */ |