Address waits v0.1.0
Waiting on a word and waking its waiters through ulock_wait and ulock_wake.
Waiting on a word and waking its waiters through __ulock_wait and __ulock_wake.
UL_COMPARE_AND_WAIT
pub const UL_COMPARE_AND_WAIT: uint32 = 1;
UL_COMPARE_AND_WAIT: wait on a 32-bit word that holds the expected value.
ULF_WAKE_ALL
pub const ULF_WAKE_ALL: uint32 = 0x100;
ULF_WAKE_ALL: wake every thread waiting on the word rather than one.
ULF_NO_ERRNO
pub const ULF_NO_ERRNO: uint32 = 0x01000000;
ULF_NO_ERRNO: report failure as a negative error number rather than through errno.
__ulock_wait
pub extern func __ulock_wait(
operation: uint32,
address: *opaque,
value: uint64,
timeout: uint32
) -> int32
Sleeps while *address equals value, until a wake, a signal or the timeout.
Parameters
| Name | Type | Description |
|---|---|---|
operation | uint32 | UL_COMPARE_AND_WAIT, combined with ULF_NO_ERRNO |
address | *opaque | the word to wait on, four-byte aligned |
value | uint64 | the value the caller last saw there |
timeout | uint32 | microseconds to wait at most, or zero to wait without a limit |
Returns: the number of waiters left, or a failure: EINTR, ETIMEDOUT, or EFAULT when the word moved
__ulock_wake
pub extern func __ulock_wake(
operation: uint32,
address: *opaque,
wakeValue: uint64
) -> int32
Wakes a thread, or all of them with ULF_WAKE_ALL, sleeping on address.
Parameters
| Name | Type | Description |
|---|---|---|
operation | uint32 | UL_COMPARE_AND_WAIT, combined with ULF_WAKE_ALL and ULF_NO_ERRNO |
address | *opaque | the word they wait on |
wakeValue | uint64 | zero |
Returns: zero, or a failure: ENOENT when nothing was waiting