class Channel

Store idle objects independently of execution mode and signal coroutine waiters.

Keep this in sync with the connection-pool channel in hypervel/pool.

Properties

protected SplQueue<object> $queue
protected Channel<bool> $signal
protected int $waiters
protected bool $closed

Methods

__construct(int $size)

Create a pool channel.

false|object
pop()

Retrieve an idle object without waiting.

bool
push(object $data)

Push an idle object and wake one waiter.

int
length()

Get the current number of objects in the channel.

bool
wait(float $timeout)

Wait for pool state to change.

void
signal()

Wake one waiter after a capacity-relevant state change.

void
pushSignal()

Push a coalesced wake signal without blocking on a full channel.

void
close()

Close the signal channel and wake every waiter.

Details

at line 32
__construct(int $size)

Create a pool channel.

Parameters

int $size

at line 41
false|object pop()

Retrieve an idle object without waiting.

Return Value

false|object

at line 49
bool push(object $data)

Push an idle object and wake one waiter.

Parameters

object $data

Return Value

bool

at line 64
int length()

Get the current number of objects in the channel.

Return Value

int

at line 72
bool wait(float $timeout)

Wait for pool state to change.

Parameters

float $timeout

Return Value

bool

at line 96
void signal()

Wake one waiter after a capacity-relevant state change.

Return Value

void

at line 118
protected void pushSignal()

Push a coalesced wake signal without blocking on a full channel.

Return Value

void

at line 128
void close()

Close the signal channel and wake every waiter.

Return Value

void