Don't include headers in a namespace definition

This commit is contained in:
Chris Robinson
2020-07-21 12:26:25 -07:00
parent 91df03f7eb
commit ac1fc1b60a
+8 -4
View File
@@ -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 */