This is automatic generated document for things in Swow\Futex class
Class Futex
A 32-bit futex in shared memory.
wait() blocks the whole OS thread, not only the current coroutine. Use it only in a worker thread that runs one coroutine. An anonymous futex is visible to threads of this process and to a forked child. A named futex is visible to another process that attaches the same name. setValue() publishes the value with release order. getValue() reads it with acquire order. Store a value before wake().
Methods
Static method attachNamed
Attach a named futex.
Static method createNamed
Create a named futex.
Static method unlink
Remove a name. An existing mapping stays valid.
Method __construct
Create an anonymous futex.
Param int $value initial signed 32-bit value
Throws \ValueError when the value does not fit Throws \Swow\SyncException when the futex cannot be created
Method __debugInfo
Return debug information.
Method __serialize
Serialize the futex by name or shared object id.
Method __unserialize
Restore the futex from a name or shared object id.
Method getSharedId
Return the shared object id.
Method getValue
Return the current value with acquire order.
Method setValue
Store a value with release order.
Method wait
Wait while the value equals expected.
this method blocks the whole OS thread
Param int $expected signed 32-bit value to compare Param int $timeout timeout in milliseconds, -1 waits forever
Returns bool false when the value changed or the timeout expired
Throws \Swow\SyncException when the wait cannot be performed
Method wake
Wake waiters. This method does not block.
A negative count wakes all waiters. A count of zero wakes none.