class Channel extends Channel implements ChannelInterface

Properties

protected bool $closed

Methods

bool
push(mixed $data, float $timeout = -1)

Push data into the channel.

mixed
pop(float $timeout = -1)

Pop data from the channel.

int
getCapacity()

Get the channel capacity.

int
getLength()

Get the current length of the channel.

bool
isAvailable()

Determine if the channel is available.

bool
close()

Close the channel.

bool
hasProducers()

Determine if the channel has producers waiting.

bool
hasConsumers()

Determine if the channel has consumers waiting.

bool
isReadable()

Determine if the channel is readable.

bool
isWritable()

Determine if the channel is writable.

bool
isClosing()

Determine if the channel is closing or closed.

bool
isTimeout()

Determine if the last operation timed out.

Details

at line 24
bool push(mixed $data, float $timeout = -1)

Push data into the channel.

Parameters

mixed $data
float $timeout

Timeout in seconds (values less than or equal to zero wait indefinitely)

Return Value

bool

at line 35
mixed pop(float $timeout = -1)

Pop data from the channel.

Parameters

float $timeout

Timeout in seconds (values less than or equal to zero wait indefinitely)

Return Value

mixed

Returns false when pop fails

at line 43
int getCapacity()

Get the channel capacity.

Return Value

int

at line 51
int getLength()

Get the current length of the channel.

Return Value

int

at line 59
bool isAvailable()

Determine if the channel is available.

Return Value

bool

at line 71
bool close()

Close the channel.

Call only from a deterministic lifecycle path while the Swoole runtime is live. Native channel methods are uncatchably fatal after the native handle is torn down, so destructors must not call this method.

Return Value

bool

at line 82
bool hasProducers()

Determine if the channel has producers waiting.

Return Value

bool

Exceptions

RuntimeException

at line 92
bool hasConsumers()

Determine if the channel has consumers waiting.

Return Value

bool

Exceptions

RuntimeException

at line 102
bool isReadable()

Determine if the channel is readable.

Return Value

bool

Exceptions

RuntimeException

at line 112
bool isWritable()

Determine if the channel is writable.

Return Value

bool

Exceptions

RuntimeException

at line 120
bool isClosing()

Determine if the channel is closing or closed.

Return Value

bool

at line 128
bool isTimeout()

Determine if the last operation timed out.

Return Value

bool