SyncSemaphore
class SyncSemaphore (View source)
SyncSemaphore
A cross-platform, native implementation of named and unnamed semaphore objects. A semaphore restricts access to a limited resource to a limited number of instances. Semaphores differ from mutexes in that they can allow more than one instance to access a resource at one time while a mutex only allows one instance at a time.
Methods
Constructs a new SyncSemaphore object
Decreases the count of the semaphore or waits
Increases the count of the semaphore
Details
__construct(string $name, int $initialval = 1, bool $autounlock = true)
Constructs a new SyncSemaphore object
Constructs a named or unnamed semaphore.
bool
lock(int $wait = -1)
Decreases the count of the semaphore or waits
Decreases the count of a SyncSemaphore object or waits until the semaphore becomes non-zero.
bool
unlock(int $prevcount = 0)
Increases the count of the semaphore
Increases the count of a SyncSemaphore object.