memory_atomic_wait64 in core::arch::wasm - Rust
Description: Corresponding intrinsic to wasm’s `memory.atomic.wait64` instruction

core::arch::wasm

# Function memory_atomic_wait64

Source

    pub unsafe fn memory_atomic_wait64(
        ptr: *mut i64,
        expression: i64,
        timeout_ns: i64,
    ) -> i32

🔬This is a nightly-only experimental API. (`stdarch_wasm_atomic_wait` #77839)
Available on `target_family="wasm"` and target feature `atomics` only.
Expand description

Corresponding intrinsic to wasm’s `memory.atomic.wait64` instruction

This function, when called, will block the current thread if the memory pointed to by `ptr` is equal to `expression` (performing this action atomically).

The argument `timeout_ns` is a maximum number of nanoseconds the calling thread will be blocked for, if it blocks. If the timeout is negative then the calling thread will be blocked forever.

The calling thread can only be woken up with a call to the `wake` intrinsic once it has been blocked. Changing the memory behind `ptr` will not wake the thread once it’s blocked.

## §Return value

- 0 - indicates that the thread blocked and then was woken up
- 1 - the loaded value from `ptr` didn’t match `expression`, the thread didn’t block
- 2 - the thread blocked, but the timeout expired.