LocalSemaphore
in package
implements
Semaphore
uses
ForbidCloning, ForbidSerialization
FinalYes
Table of Contents
Interfaces
- Semaphore
- A counting semaphore.
Properties
- $locks : int
- $maxLocks : int
- $waiting : SplQueue<string|int, Suspension>
Methods
- __construct() : mixed
- __serialize() : never
- __unserialize() : never
- acquire() : Lock
- Acquires a lock on the semaphore. Semaphores may have one or more locks.
- __clone() : mixed
- createLock() : Lock
- release() : void
Properties
$locks
private
int
$locks
= 0
$maxLocks read-only
private
int
$maxLocks
$waiting read-only
private
SplQueue<string|int, Suspension>
$waiting
Methods
__construct()
public
__construct(positive-int $maxLocks) : mixed
Parameters
- $maxLocks : positive-int
__serialize()
public
final __serialize() : never
Return values
never__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : never
Parameters
- $data : array<string|int, mixed>
Return values
neveracquire()
Acquires a lock on the semaphore. Semaphores may have one or more locks.
public
acquire() : Lock
Return values
Lock —Returns with a lock object once a lock is obtained. May fail with a SyncException if an error occurs when attempting to obtain the lock (e.g. a shared memory segment closed).
__clone()
protected
final __clone() : mixed
createLock()
private
createLock() : Lock
Return values
Lockrelease()
private
release() : void