Documentation

Sync

Table of Contents

Interfaces

Channel
Interface for sending messages between execution contexts, such as two coroutines or two processes.
KeyedMutex
A synchronization primitive that can be used for mutual exclusion across contexts based on keys.
KeyedSemaphore
A counting semaphore based on keys.
Mutex
A synchronization primitive that can be used for mutual exclusion across contexts.
Parcel
Semaphore
A counting semaphore.

Classes

Barrier
A barrier is a synchronization primitive.
ChannelException
LocalKeyedMutex
LocalKeyedSemaphore
LocalMutex
LocalParcel
LocalSemaphore
Lock
A handle on an acquired lock from a synchronization object.
ParcelException
PosixSemaphore
A non-blocking, inter-process POSIX semaphore.
PrefixedKeyedMutex
PrefixedKeyedSemaphore
PriorityQueue
Uses a binary tree stored in an array to implement a heap.
RateLimitingSemaphore
When a locked is released from this semaphore, it does not become available to be acquired again until the given lock-period has elapsed. This is useful when a number of operations or requests must be limited to a particular quantity within a certain time period.
SemaphoreMutex
SharedMemoryParcel
A container object for sharing a value across contexts.
StaticKeyMutex
StaticKeySemaphore
SyncException

Functions

synchronized()  : T
Invokes the given Closure while maintaining a lock from the provided mutex.
createChannelPair()  : Channel}

Functions

synchronized()

Invokes the given Closure while maintaining a lock from the provided mutex.

synchronized(Semaphore $semaphore, callable(mixed...): T $synchronized, mixed ...$args) : T

The lock is automatically released after the Closure returns.

Parameters
$semaphore : Semaphore
$synchronized : callable(mixed...): T
$args : mixed
Tags
template
Return values
T

The return value of the Closure.

createChannelPair()

createChannelPair([int $bufferSize = 0 ]) : Channel}
Parameters
$bufferSize : int = 0

Number of channel items to buffer in memory before back-pressure is applied.

Return values
Channel}

        
On this page

Search results