Address waits v0.1.0

Source
Waiting on a word and waking its waiters through _umtx_op.

UMTX_OP_WAIT_UINT_PRIVATE

pub const UMTX_OP_WAIT_UINT_PRIVATE: int32 = 15;

UMTX_OP_WAIT_UINT_PRIVATE: sleep while a 32-bit word holds the expected value.

Source

UMTX_OP_WAKE_PRIVATE

pub const UMTX_OP_WAKE_PRIVATE: int32 = 16;

UMTX_OP_WAKE_PRIVATE: wake threads sleeping on the word.

Source

UmtxWait

pub func UmtxWait(
    address: *uint32,
    expected: uint32,
    timeout: *Timespec
) -> int64

Sleeps while *address equals expected, until a wake, a signal or the timeout.

See also: https://man.freebsd.org/cgi/man.cgi?query=_umtx_op&sektion=2

Source

Parameters

NameTypeDescription
address*uint32the word to wait on, four-byte aligned
expecteduint32the value the caller last saw there
timeout*Timespechow long to wait at most, relative to now, or null to wait without a limit

Returns: zero after a wake or when the word already differs, or a negative error number: EINTR or ETIMEDOUT

UmtxWake

pub func UmtxWake(address: *uint32, count: int32) -> int64

Wakes up to count threads sleeping on address.

See also: https://man.freebsd.org/cgi/man.cgi?query=_umtx_op&sektion=2

Source

Parameters

NameTypeDescription
address*uint32the word they wait on
countint32how many to wake at most

Returns: zero, or a negative error number