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 if lock acquired, false if timeout or channel closing

at line 43
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 if unlocked successfully, false if timeout (unlock called more than once)

at line 60
static void clear(string $key)

Clear and close the mutex channel for the given key.

Parameters

string $key

Return Value

void

at line 72
static void flushState()

Flush all static state.

Return Value

void