summaryrefslogtreecommitdiff
path: root/absl/synchronization/internal/futex.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/synchronization/internal/futex.h')
-rw-r--r--absl/synchronization/internal/futex.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/absl/synchronization/internal/futex.h b/absl/synchronization/internal/futex.h
index 3539f491..06fbd6d0 100644
--- a/absl/synchronization/internal/futex.h
+++ b/absl/synchronization/internal/futex.h
@@ -38,6 +38,19 @@
#include "absl/base/optimization.h"
#include "absl/synchronization/internal/kernel_timeout.h"
+#ifdef ABSL_INTERNAL_HAVE_FUTEX
+#error ABSL_INTERNAL_HAVE_FUTEX may not be set on the command line
+#elif defined(__BIONIC__)
+// Bionic supports all the futex operations we need even when some of the futex
+// definitions are missing.
+#define ABSL_INTERNAL_HAVE_FUTEX
+#elif defined(__linux__) && defined(FUTEX_CLOCK_REALTIME)
+// FUTEX_CLOCK_REALTIME requires Linux >= 2.6.28.
+#define ABSL_INTERNAL_HAVE_FUTEX
+#endif
+
+#ifdef ABSL_INTERNAL_HAVE_FUTEX
+
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace synchronization_internal {
@@ -136,4 +149,6 @@ class Futex : public FutexImpl {};
ABSL_NAMESPACE_END
} // namespace absl
+#endif // ABSL_INTERNAL_HAVE_FUTEX
+
#endif // ABSL_SYNCHRONIZATION_INTERNAL_FUTEX_H_