1# zx_futex_wait
2
3## NAME
4
5futex_wait - Wait on a futex.
6
7## SYNOPSIS
8
9```
10#include <zircon/syscalls.h>
11
12zx_status_t zx_futex_wait(const zx_futex_t* value_ptr, int32_t current_value,
13                          zx_time_t deadline);
14```
15
16## DESCRIPTION
17
18**futex_wait**() atomically verifies that *value_ptr* still contains the value
19*current_value* and sleeps until the futex is made available by a call to
20`zx_futex_wake`. Optionally, the thread can also be woken up after the
21*deadline* (with respect to **ZX_CLOCK_MONOTONIC**) passes.
22
23## RIGHTS
24
25TODO(ZX-2399)
26
27## RETURN VALUE
28
29**futex_wait**() returns **ZX_OK** on success.
30
31## ERRORS
32
33**ZX_ERR_INVALID_ARGS**  *value_ptr* is not a valid userspace pointer, or
34*value_ptr* is not aligned.
35
36**ZX_ERR_BAD_STATE**  *current_value* does not match the value at *value_ptr*.
37
38**ZX_ERR_TIMED_OUT**  The thread was not woken before *deadline* passed.
39
40## SEE ALSO
41
42[futex_requeue](futex_requeue.md),
43[futex_wake](futex_wake.md).
44