PHP Класс Icicle\Concurrent\Threading\Internal\Semaphore

Наследование: extends Threaded
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( integer $locks ) Creates a new semaphore with a given number of locks.
acquire ( ) : Generator Uses a double locking mechanism to acquire a lock without blocking. A synchronous mutex is used to make sure that the semaphore is queried one at a time to preserve the integrity of the semaphore itself. Then a lock count is used to check if a lock is available without blocking.
count ( ) : integer Gets the number of currently available locks.

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

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

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

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

Creates a new semaphore with a given number of locks.
public __construct ( integer $locks )
$locks integer The maximum number of locks that can be acquired from the semaphore.

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

If a lock is not available, we add the request to a queue and set a timer to check again in the future.
public acquire ( ) : Generator
Результат Generator

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

Gets the number of currently available locks.
public count ( ) : integer
Результат integer The number of available locks.

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

Releases a lock from the semaphore.
protected release ( )