PoolChannel
class PoolChannel
Store idle objects independently of execution mode and signal coroutine waiters.
Properties
| protected T> | $queue | ||
| protected Channel<bool> | $signal | ||
| protected int | $waiters | ||
| protected bool | $closed |
Methods
Create a pool channel.
Retrieve an idle object without waiting.
Push an idle object and wake one waiter.
Get the current number of objects in the channel.
Get the number of coroutines waiting for pool state to change.
Wait for pool state to change.
Wake one waiter after a capacity-relevant state change.
Push a coalesced wake signal without blocking on a full channel.
Close the signal channel and wake every waiter.
Details
at line 32
__construct(int $size)
Create a pool channel.
at line 43
false|object
pop()
Retrieve an idle object without waiting.
at line 53
bool
push(object $data)
Push an idle object and wake one waiter.
at line 68
int
length()
Get the current number of objects in the channel.
at line 76
int
waiters()
Get the number of coroutines waiting for pool state to change.
at line 84
bool
wait(float $timeout)
Wait for pool state to change.
at line 112
void
signal()
Wake one waiter after a capacity-relevant state change.
at line 134
protected void
pushSignal()
Push a coalesced wake signal without blocking on a full channel.
at line 144
void
close()
Close the signal channel and wake every waiter.