Lock
in package
FinalYes
A handle on an acquired lock from a synchronization object.
This object is not thread-safe; after acquiring a lock from a mutex or semaphore, the lock should reside in the same thread or process until it is released.
Table of Contents
Properties
- $pendingOperations : SplObjectStorage|null
- $release : null|callable(): void
- $testFiber : Fiber|null
Methods
- __construct() : mixed
- Creates a new lock permit object.
- __destruct() : mixed
- Releases the lock when there are no more references to it.
- isReleased() : bool
- Checks if the lock has already been released.
- release() : void
- Releases the lock. No-op if the lock has already been released.
- isForceClosed() : bool
- setupPendingOperations() : SplObjectStorage
Properties
$pendingOperations
private
static SplObjectStorage|null
$pendingOperations
= null
$release
private
null|callable(): void
$release
The function to be called on release or null if the lock has been released.
$testFiber
private
static Fiber|null
$testFiber
= null
Methods
__construct()
Creates a new lock permit object.
public
__construct(callable(): void $release) : mixed
Parameters
- $release : callable(): void
-
A function to be called upon release.
__destruct()
Releases the lock when there are no more references to it.
public
__destruct() : mixed
isReleased()
Checks if the lock has already been released.
public
isReleased() : bool
Return values
bool —True if the lock has already been released, otherwise false.
release()
Releases the lock. No-op if the lock has already been released.
public
release() : void
isForceClosed()
private
isForceClosed() : bool
Return values
boolsetupPendingOperations()
private
static setupPendingOperations() : SplObjectStorage