Method | Description | |
---|---|---|
__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. |
Method | Description | |
---|---|---|
release ( ) | Releases a lock from the semaphore. |
public __construct ( integer $locks ) | ||
$locks | integer | The maximum number of locks that can be acquired from the semaphore. |