PHP Класс Icicle\Concurrent\Sync\PosixSemaphore

Uses a POSIX message queue to store a queue of permits in a lock-free data structure. This semaphore implementation is preferred over other implementations when available, as it provides the best performance. Not compatible with Windows.
Наследование: implements Icicle\Concurrent\Sync\SemaphoreInterface, implements Serializable
Показать файл Открыть проект

Открытые методы

Метод Описание
__clone ( ) Clones the semaphore, creating a new semaphore with the same size and permissions.
__construct ( integer $maxLocks, integer $permissions = 384 ) Creates a new semaphore with a given number of locks.
acquire ( ) : Generator
count ( ) : integer
free ( ) Removes the semaphore if it still exists.
getPermissions ( ) : integer Gets the access permissions of the semaphore.
getSize ( ) : integer Gets the maximum number of locks held by the semaphore.
isFreed ( ) : boolean Checks if the semaphore has been freed.
serialize ( ) : string Serializes the semaphore.
setPermissions ( integer $mode ) Sets the access permissions of the semaphore.
unserialize ( string $serialized ) Unserializes a serialized semaphore.

Защищенные методы

Метод Описание
release ( ) Releases a lock from the semaphore.

Приватные методы

Метод Описание
init ( integer $maxLocks, integer $permissions )

Описание методов

__clone() публичный Метод

Clones the semaphore, creating a new semaphore with the same size and permissions.
public __clone ( )

__construct() публичный Метод

Creates a new semaphore with a given number of locks.
public __construct ( integer $maxLocks, integer $permissions = 384 )
$maxLocks integer The maximum number of locks that can be acquired from the semaphore.
$permissions integer Permissions to access the semaphore.

acquire() публичный Метод

public acquire ( ) : Generator
Результат Generator

count() публичный Метод

public count ( ) : integer
Результат integer

free() публичный Метод

Removes the semaphore if it still exists.
public free ( )

getPermissions() публичный Метод

Gets the access permissions of the semaphore.
public getPermissions ( ) : integer
Результат integer A permissions mode.

getSize() публичный Метод

Gets the maximum number of locks held by the semaphore.
public getSize ( ) : integer
Результат integer The maximum number of locks held by the semaphore.

isFreed() публичный Метод

Checks if the semaphore has been freed.
public isFreed ( ) : boolean
Результат boolean True if the semaphore has been freed, otherwise false.

release() защищенный Метод

Releases a lock from the semaphore.
protected release ( )

serialize() публичный Метод

Serializes the semaphore.
public serialize ( ) : string
Результат string The serialized semaphore.

setPermissions() публичный Метод

The current user must have access to the semaphore in order to change the permissions.
public setPermissions ( integer $mode )
$mode integer A permissions mode to set.

unserialize() публичный Метод

Unserializes a serialized semaphore.
public unserialize ( string $serialized )
$serialized string The serialized semaphore.