// Futex Implementation
//===----------------------------------------------------------------------===//
-#if defined(SYS_futex)
+#ifdef __OpenBSD__
+#include <sys/futex.h>
+
+void PlatformFutexWait(int* addr, int expect) {
+ constexpr int WAIT = 0;
+ futex((volatile uint32_t *)addr, WAIT, expect, NULL, NULL);
+ __tsan_acquire(addr);
+}
+void PlatformFutexWake(int* addr) {
+ constexpr int WAKE = 1;
+ __tsan_release(addr);
+ futex((volatile uint32_t *)addr, WAKE, INT_MAX, NULL, NULL);
+}
+#elif defined(SYS_futex)
void PlatformFutexWait(int* addr, int expect) {
constexpr int WAIT = 0;
syscall(SYS_futex, addr, WAIT, expect, 0);