interface SemaphoreInterface

SemaphoreInterface defines an interface to manipulate the status of a semaphore.

Methods

bool
acquire()

Acquires the semaphore. If the semaphore has reached its limit.

void
refresh(float|null$ttlInSecond =null)

Increase the duration of an acquired semaphore.

bool
isAcquired()

Returns whether or not the semaphore is acquired.

void
release()

Release the semaphore.

bool
isExpired()

No description

float|null
getRemainingLifetime()

Returns the remaining lifetime.

Details

bool acquire()

Acquires the semaphore. If the semaphore has reached its limit.

Return Value

bool

Exceptions

SemaphoreAcquiringException If the semaphore cannot be acquired

void refresh(float|null$ttlInSecond =null)

Increase the duration of an acquired semaphore.

Parameters

float|null $ttlInSecond

Return Value

void

Exceptions

SemaphoreExpiredException If the semaphore has expired

bool isAcquired()

Returns whether or not the semaphore is acquired.

Return Value

bool

void release()

Release the semaphore.

Return Value

void

Exceptions

SemaphoreReleasingException If the semaphore cannot be released

bool isExpired()

Return Value

bool

float|null getRemainingLifetime()

Returns the remaining lifetime.

Return Value

float|null