Skip to main content

Module sync

Module sync 

Source
Expand description

Waiting on a shared 32-bit word, the primitive under every “wake me when this changes” in Orbit: ring readiness, cell changes.

wait_word parks the caller until the word no longer holds expected (or spuriously; callers loop). wake_word wakes every waiter on it. The word may live in shared memory: Linux futex, FreeBSD umtx and macOS os_sync_wait_on_address all key waiters by the physical location, so a wake in one process reaches a waiter in another with nothing carried between them. No descriptor, no channel: the memory is the signal.

macOS needs 14.4 for the shared form. Below that there is no wait to be had, and supported says so: a crate that parks on words refuses to open rather than pretending, because a sleep loop wearing the shape of a wait is worse than a clear no.

Functions§

supported
Whether this build can park on a shared word at all.
wait_word
wait_word_timeout
Park until the word no longer holds expected, or timeout passes.
wake_word