| Previous | Next
Thread::SemaphoreProvides a mechanism to regulate access to resources. Semaphores are more general than locks because they aren't tied to a particular scalar. They can have values other than or and can be incremented or decremented by a specified number.
$sem = new Thread::Semaphore([val]) Constructor. Creates a new semaphore object, with an optional initial count of
down [number] Decrements the semaphore's count by the specified number, which defaults to . If the resulting count would be negative, blocks until the semaphore's count has been increased to be equal to or larger than the amount you want to decrease it.
up [number] Increments the semaphore's count by the specified number, which defaults to . If a thread is blocked waiting to decrement the count, and the increment brings the count high enough, the blocked thread is unblocked. |