From 45305be5a3a3b8dc7bccf4263a709d736fe9f2c7 Mon Sep 17 00:00:00 2001
From: Alexander van Amesfoort <amesfoort@astron.nl>
Date: Fri, 17 Mar 2017 16:19:45 +0000
Subject: [PATCH] Task #8691: improve Barrier ifdef for OS X

---
 LCS/Common/include/Common/Thread/Barrier.h | 7 +++++++
 LCS/Common/test/tBarrier.cc                | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/LCS/Common/include/Common/Thread/Barrier.h b/LCS/Common/include/Common/Thread/Barrier.h
index c3bb891b540..67f5a2c3d6f 100644
--- a/LCS/Common/include/Common/Thread/Barrier.h
+++ b/LCS/Common/include/Common/Thread/Barrier.h
@@ -26,6 +26,12 @@
 #ifdef USE_THREADS
 
 #include <pthread.h>
+
+#if !_POSIX_BARRIERS  // OS X
+// Don't bother yet providing our own barrier impl. We hardly use it. Just warn.
+#warning _POSIX_BARRIERS not defined on this system: code using LOFAR::Barrier will not compile
+#else
+
 #include <Common/LofarLogger.h>
 #include <Common/SystemCallException.h>
 
@@ -73,6 +79,7 @@ private:
 
 } // namespace LOFAR
 
+#endif
 #endif
 
 #endif
diff --git a/LCS/Common/test/tBarrier.cc b/LCS/Common/test/tBarrier.cc
index aa70fe2d0f7..500ab23ad33 100644
--- a/LCS/Common/test/tBarrier.cc
+++ b/LCS/Common/test/tBarrier.cc
@@ -27,6 +27,11 @@
 #include <Common/Thread/Thread.h>
 #include <Common/Thread/Barrier.h>
 
+#if !_POSIX_BARRIERS  // OS X
+#warning _POSIX_BARRIERS not defined on this system: tBarrier test disarmed
+#undef USE_THREADS
+#endif
+
 using namespace std;
 using namespace LOFAR;
 
-- 
GitLab