class Mutex

Properties

static protected Channel> $channels

Methods

static bool
lock(string $key, float $timeout = -1)

Acquire a mutex lock for the given key.

static bool
unlock(string $key, float $timeout = 5)

Release a mutex lock for the given key.

static void
clear(string $key)

Clear and close the mutex channel for the given key.

static void
flushState()

Flush all static state.

Details

at line 22
static bool lock(string $key, float $timeout = -1)

Acquire a mutex lock for the given key.

Parameters

string $key
float $timeout

Timeout in seconds (-1 for unlimited)

Return Value

bool

True when the acquisition token was accepted, false when the push failed

at line 39
static bool unlock(string $key, float $timeout = 5)

Release a mutex lock for the given key.

Parameters

string $key
float $timeout

Timeout in seconds

Return Value

bool

True when a held token was released, false when no token was held or the pop failed

at line 63
static void clear(string $key)

Clear and close the mutex channel for the given key.

Parameters

string $key

Return Value

void

at line 75
static void flushState()

Flush all static state.

Return Value

void