diff --git a/libc-bottom-half/sources/__wasilibc_futex.c b/libc-bottom-half/sources/__wasilibc_futex.c index d018c42e6..b9c642656 100644 --- a/libc-bottom-half/sources/__wasilibc_futex.c +++ b/libc-bottom-half/sources/__wasilibc_futex.c @@ -12,9 +12,9 @@ int __wasilibc_futex_wait_wasix(volatile void *addr, int op, int expected, int64 __wasi_bool_t woken = __WASI_BOOL_FALSE; __wasi_option_timestamp_t timeout; - if (max_wait_ns > 0) { + if (max_wait_ns >= 0) { timeout.tag = __WASI_OPTION_SOME; - timeout.u.none = max_wait_ns; + timeout.u.some = max_wait_ns; } else { timeout.tag = __WASI_OPTION_NONE; timeout.u.none = 0; diff --git a/libc-top-half/musl/src/thread/__timedwait.c b/libc-top-half/musl/src/thread/__timedwait.c index e0d3fc528..2a0a18f20 100644 --- a/libc-top-half/musl/src/thread/__timedwait.c +++ b/libc-top-half/musl/src/thread/__timedwait.c @@ -60,7 +60,6 @@ int __timedwait_cp(volatile int *addr, int val, top = &to; } -#ifdef __wasilibc_unmodified_upstream r = -__futex4_cp(addr, FUTEX_WAIT|priv, val, top); if (r != EINTR && r != ETIMEDOUT && r != ECANCELED) r = 0; /* Mitigate bug in old kernels wrongly reporting EINTR for non- @@ -68,11 +67,6 @@ int __timedwait_cp(volatile int *addr, int val, * when NO interrupting signal handlers have been installed, and * works by sigaction tracking whether that's the case. */ if (r == EINTR && !__eintr_valid_flag) r = 0; -#else - volatile int waiters = 0; - __wait(addr, &waiters, val, 0); - r = 0; -#endif return r; }