#define UTIL_FUTEX_H
#if defined(HAVE_LINUX_FUTEX_H)
+#define UTIL_FUTEX_SUPPORTED 1
#include <limits.h>
#include <stdint.h>
}
#elif defined(__FreeBSD__)
+#define UTIL_FUTEX_SUPPORTED 1
#include <assert.h>
#include <errno.h>
}
#elif defined(__OpenBSD__)
+#define UTIL_FUTEX_SUPPORTED 1
#include <sys/time.h>
#include <sys/futex.h>
return futex(addr, FUTEX_WAIT, value, &tsrel, NULL);
}
+#else
+#define UTIL_FUTEX_SUPPORTED 0
#endif
#endif /* UTIL_FUTEX_H */
#include "c11/threads.h"
-#if defined(__GNUC__) && defined(HAVE_LINUX_FUTEX_H)
+#if UTIL_FUTEX_SUPPORTED
/* mtx_t - Fast, simple mutex
*
#define UTIL_QUEUE_INIT_RESIZE_IF_FULL (1 << 1)
#define UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY (1 << 2)
-#if defined(__GNUC__) && defined(HAVE_LINUX_FUTEX_H)
+#if UTIL_FUTEX_SUPPORTED
#define UTIL_QUEUE_FENCE_FUTEX
#else
#define UTIL_QUEUE_FENCE_STANDARD