|FUTEX(2)||System Calls Manual||FUTEX(2)|
futex — fast
userspace locking primitive
futex(volatile uint32_t *uaddr,
int op, int val,
const struct timespec *timeout,
volatile uint32_t *uaddr2);
futex() syscall provides sleep and
wakeup primitives related to a particular address.
Three op operations are currently supported:
FUTEX_REQUEUEoperation with the same uaddr address. uaddr2 is ignored.
FUTEX_WAKEbut also requeue remaining threads from the wait channel uaddr to uaddr2. In this case, pass uint32_t val2 as the fourth argument instead of timeout. At most that number of threads is requeued.
returns the number of woken threads.
futex() returns zero if woken by a matching
call, otherwise an error number is returned to indicate the error.
futex() will fail if:
Ulrich Drepper, Futexes Are Tricky, https://www.akkadia.org/drepper/futex.pdf, November 5, 2011.
futex() syscall first appeared in
Linux 2.5.7 and was added to OpenBSD 6.2.
|January 18, 2019||OpenBSD-current|