wait_u32_eq

Function wait_u32_eq 

Source
pub unsafe fn wait_u32_eq(
    addr: *const u32,
    expected: u32,
    timeout: Option<Duration>,
) -> Result<(), WaitError>
Expand description

Wait while the 32-bit value at addr equals expected.

Semantics (mirrors futex / WaitOnAddress):

  • If *addr != expected, returns immediately with Ok(()).
  • Otherwise, blocks until woken, the value changes, or timeout elapses.

This call may return Ok(()) even if the value is still equal (spurious wakeups); callers should always re-check the condition in a loop.

§Errors

§Safety

  • addr must be valid to read a u32 for the duration of the call.
  • addr must be aligned to 4 bytes.
  • If other threads/processes mutate the value concurrently, the memory at addr must be accessed in a race-free way (typically by storing through an AtomicU32 at the same address and passing its pointer cast to *const u32).