PHP Class Icicle\Concurrent\Threading\Semaphore

This is an implementation of a thread-safe semaphore that has non-blocking acquire methods. There is a small tradeoff for asynchronous semaphores; you may not acquire a lock immediately when one is available and there may be a small delay. However, the small delay will not block the thread.
Inheritance: implements Icicle\Concurrent\Sync\SemaphoreInterface
Afficher le fichier Open project: icicleio/concurrent

Méthodes publiques

Méthode Description
__clone ( ) Clones the semaphore, creating a new instance with the same number of locks, all available.
__construct ( integer $locks ) Creates a new semaphore with a given number of locks.
acquire ( ) : Generator
count ( ) : integer
getSize ( ) : integer

Private Methods

Méthode Description
init ( integer $locks ) Initializes the semaphore with a given number of locks.

Method Details

__clone() public méthode

Clones the semaphore, creating a new instance with the same number of locks, all available.
public __clone ( )

__construct() public méthode

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() public méthode

public acquire ( ) : Generator
Résultat Generator

count() public méthode

public count ( ) : integer
Résultat integer

getSize() public méthode

public getSize ( ) : integer
Résultat integer