summaryrefslogtreecommitdiff
path: root/src/semaphore.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-12-08 17:36:50 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2016-12-08 17:36:50 +0100
commit6796cfa72452552cc4d0f6bcfdbecace682ea1f6 (patch)
tree38759ca1acd104624840cdd46405d5cb5372ff08 /src/semaphore.cc
parent99cb62d88e434a1fc3d7bd055e956a9ce352c9b3 (diff)
Fix include order
Diffstat (limited to 'src/semaphore.cc')
-rw-r--r--src/semaphore.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/semaphore.cc b/src/semaphore.cc
index 4a24e27..77bce9a 100644
--- a/src/semaphore.cc
+++ b/src/semaphore.cc
@@ -33,23 +33,21 @@
#include "platform.h"
-#if DG_PLATFORM != DG_PLATFORM_WINDOWS
-// Make sure we don't include /this/ file's header...
-#include <../include/semaphore.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/time.h>
-#endif
-
#if DG_PLATFORM == DG_PLATFORM_OSX
//#include <Multiprocessing.h>
#include <CoreServices/CoreServices.h>
-#endif
-#if DG_PLATFORM == DG_PLATFORM_FREEBSD
+#elif DG_PLATFORM == DG_PLATFORM_FREEBSD
#include <sys/types.h>
#include <sys/lock.h>
#include <sys/sema.h>
+
+#elif DG_PLATFORM != DG_PLATFORM_WINDOWS
+// Make sure we don't include /this/ file's header...
+#include <../include/semaphore.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/time.h>
#endif
struct semaphore_private_t {
@@ -131,7 +129,11 @@ bool Semaphore::wait(const std::chrono::milliseconds& timeout)
return false;
}
#elif DG_PLATFORM == DG_PLATFORM_FREEBSD
- sema_timedwait(prv->semaphore, timeout.count());
+ auto ret = sema_timedwait(prv->semaphore, timeout.count());
+ if(ret != 0)
+ {
+ return false;
+ }
#else
struct timespec ts;