aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-07-21 12:26:25 -0700
committerChris Robinson <[email protected]>2020-07-23 09:03:47 -0700
commitac1fc1b60ac7dcdce61c875b2d547079eea30bcd (patch)
treeacc6bcdef0242db47a22490f032bbdb9b8b3dcea /common
parent91df03f7eb309cd7d34ebab95e67e18438d25c0c (diff)
Don't include headers in a namespace definition
Diffstat (limited to 'common')
-rw-r--r--common/threads.cpp12
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 */