--- include/urcu/futex.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/include/urcu/futex.h b/include/urcu/futex.h index c206c6f..33dc3db 100644 --- a/include/urcu/futex.h +++ b/include/urcu/futex.h @@ -24,6 +24,7 @@ */ #include <urcu/config.h> +#include <errno.h> #include <stdint.h> #include <time.h> @@ -103,6 +104,28 @@ static inline int futex_async(int32_t *uaddr, int op, int32_t val, return ret; } +#elif defined(__FreeBSD__) + +#include <sys/umtx.h> + +static inline int futex_noasync(int32_t *uaddr, int op, int32_t val, + const struct timespec *timeout, int32_t *uaddr2, int32_t val3) +{ + return futex_async(uaddr, op, val, timeout, uaddr2, val3); +} + +static inline int futex_async(int32_t *uaddr, int op, int32_t val, + const struct timespec *timeout, int32_t *uaddr2, int32_t val3) +{ + switch (op) { + case FUTEX_WAIT: op = UMTX_OP_WAIT_UINT; break; + case FUTEX_WAKE: op = UMTX_OP_WAKE; break; + default: errno = EINVAL; return -1; + } + return _umtx_op(uaddr, op, val, + (void *)sizeof(*timeout), (void *)timeout); +} + #elif defined(__CYGWIN__) /* -- 2.25.0 _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev