futex_wait - Wait on a futex.
#include <magenta/syscalls.h> mx_status_t mx_futex_wait(mx_futex_t* value_ptr, int current_value, mx_time_t deadline);
Waiting on a futex (or acquiring it) causes a thread to sleep until the futex is made available by a call to
mx_futex_wake. Optionally, the thread can also be woken up after the deadline (with respect to MX_CLOCK_MONOTONIC) passes.
futex_wait() returns MX_OK on success.
MX_ERR_INVALID_ARGS value_ptr is not a valid userspace pointer, or value_ptr is not aligned.
MX_ERR_BAD_STATE current_value does not match the value at value_ptr.
MX_ERR_TIMED_OUT The thread was not woken before deadline passed.