This is automatic generated document for things in Swow\Sync\ThreadBarrier class
Class ThreadBarrier
A reusable barrier for a fixed number of OS threads.
wait() blocks the whole OS thread, not only the current coroutine. Use it only in a worker thread that runs one coroutine. A cycle releases when count threads wait. The barrier works in one process only.
Methods
Method __construct
Create a barrier.
Param int $count number of threads in one cycle
Throws \ValueError when the count is out of range Throws SyncException when the barrier is already constructed
Method __debugInfo
Return debug information.
Method __serialize
Serialize the barrier by shared object id.
Method __unserialize
Restore the barrier from a shared object id.
Method getCount
Return the number of threads in one cycle.
Method getWaiting
Return the number of threads currently waiting.
Method wait
Wait for the other threads.
this method blocks the whole OS thread
Param int $timeout timeout in milliseconds, -1 waits forever
Returns bool false on timeout
Throws SyncException when the caller cannot wait