Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

futexWait

Public Function
std.Io.futexWait
pub fn futexWait(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T) Cancelable!void

Atomically checks if the value at ptr equals expected, and if so, blocks until either:

  • a matching (same ptr argument) futexWake call occurs, or
  • a spurious ("random") wakeup occurs.

Typically, futexWake should be called immediately after updating the value at ptr.*, to unblock tasks using futexWait to wait for the value to change from what it previously was.

The caller is responsible for identifying spurious wakeups if necessary, typically by checking the value at ptr.*.

Asserts that T is 4 bytes in length and has a well-defined layout with no padding bits.

Params

  • io: Io
  • T: type
  • ptr: *align(@alignOf(u32)) const T
  • expected: T

Errors

Canceled

Caller has requested the async operation to stop.

File

Io.zig:1675
1675
1676
1677
pub fn futexWait(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T) Cancelable!void {
    return futexWaitTimeout(io, T, ptr, expected, .none);
}