class Futex
package digigun.sys.sync
Ultra-low-level synchronization primitive based on Linux Futex and Windows WaitOnAddress. Allows threads to efficiently wait on a memory address until notified.
Static methods
staticwait(buffer:NativeBuffer, byteOffset:Int, expectedValue:Int):Bool
Blocks the current thread if the value at the given buffer location matches expectedValue.
Parameters:
buffer | The NativeBuffer containing the 32-bit integer. |
|---|---|
byteOffset | Offset in bytes from the start of the buffer (must be 4-byte aligned). |
expectedValue | The value that must be present to trigger the wait. |
Returns:
True if the wait was successful (awoken or value already changed).
staticwake(buffer:NativeBuffer, byteOffset:Int):Int
Wakes a single thread waiting on the given buffer location.
staticwakeAll(buffer:NativeBuffer, byteOffset:Int):Int
Wakes all threads waiting on the given buffer location.