aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_config.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-27 20:45:07 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-27 20:45:07 -0800
commitf10feb5b243b979e554db87ef07bcd10786474c2 (patch)
tree7fdc7ff2536c10c7db9747667bf9e5eab71d18cd /src/platform/posix/posix_config.h
parentca74e80e9b0695a1c374840058025e567189dd14 (diff)
downloadnng-f10feb5b243b979e554db87ef07bcd10786474c2.tar.gz
nng-f10feb5b243b979e554db87ef07bcd10786474c2.tar.bz2
nng-f10feb5b243b979e554db87ef07bcd10786474c2.zip
Condvars on MacOS X (even 10.12) don't work with monotonic times.
Diffstat (limited to 'src/platform/posix/posix_config.h')
-rw-r--r--src/platform/posix/posix_config.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/platform/posix/posix_config.h b/src/platform/posix/posix_config.h
index 1510d739..6d282f63 100644
--- a/src/platform/posix/posix_config.h
+++ b/src/platform/posix/posix_config.h
@@ -38,12 +38,17 @@
#include <time.h>
+// MacOS X used to lack CLOCK_MONOTONIC. Now it has it, but its
+// buggy, condition variables set to use it wake early.
+#ifdef __APPLE__
+#define NNG_USE_CLOCKID CLOCK_REALTIME
+#endif // __APPLE__
+
+#define NNG_USE_CLOCKID CLOCK_REALTIME
#ifndef CLOCK_REALTIME
#define NNG_USE_GETTIMEOFDAY
#elif !defined(NNG_USE_CLOCKID)
-#ifdef CLOCK_MONOTONIC
#define NNG_USE_CLOCKID CLOCK_MONOTONIC
#else
#define NNG_USE_CLOCKID CLOCK_REALTIME
-#endif
#endif // CLOCK_REALTIME