Address waits v0.1.0
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.
UMTX_OP_WAKE_PRIVATE
pub const UMTX_OP_WAKE_PRIVATE: int32 = 16;
UMTX_OP_WAKE_PRIVATE: wake threads sleeping on the word.
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
Parameters
| Name | Type | Description |
|---|---|---|
address | *uint32 | the word to wait on, four-byte aligned |
expected | uint32 | the value the caller last saw there |
timeout | *Timespec | how 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
Parameters
| Name | Type | Description |
|---|---|---|
address | *uint32 | the word they wait on |
count | int32 | how many to wake at most |
Returns: zero, or a negative error number