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
isCanceled()

Determine if the last operation was canceled.

bool
isTimeout()

Determine if the last operation timed out.

Details

at line 25
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 37
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 45
int getCapacity()

Get the channel capacity.

Return Value

int

at line 53
int getLength()

Get the current length of the channel.

Return Value

int

at line 61
bool isAvailable()

Determine if the channel is available.

Return Value

bool

at line 75
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 86
bool hasProducers()

Determine if the channel has producers waiting.

Return Value

bool

Exceptions

RuntimeException

at line 96
bool hasConsumers()

Determine if the channel has consumers waiting.

Return Value

bool

Exceptions

RuntimeException

at line 106
bool isReadable()

Determine if the channel is readable.

Return Value

bool

Exceptions

RuntimeException

at line 116
bool isWritable()

Determine if the channel is writable.

Return Value

bool

Exceptions

RuntimeException

at line 124
bool isClosing()

Determine if the channel is closing or closed.

Return Value

bool

at line 134
bool isCanceled()

Determine if the last operation was canceled.

This state must be inspected immediately after a failed operation.

Return Value

bool

at line 142
bool isTimeout()

Determine if the last operation timed out.

Return Value

bool