PHP 클래스 Icicle\Concurrent\Threading\Internal\Semaphore

상속: extends Threaded
파일 보기 프로젝트 열기: icicleio/concurrent 1 사용 예제들

공개 메소드들

메소드 설명
__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 ( )