phasync\Internal\ChannelUnbuffered
final
class
Documentation
This is a highly optimized implementation of a bi-directional channel
for communication between coroutines running in the same memory space
without threading. It is not meant to be used directly since it has
no protection against deadlocks. Instead channels should be created
via phasync::channel().
The implementation reaches around 500 000 reads and 500 000 writes between a pair of coroutines on an AMD Ryzen 7 2700X.
Inheritance
Implements:
phasync\Internal\ChannelBackendInterface
IteratorAggregate
phasync\SelectableInterface
Traversable
phasync\WriteChannelInterface
phasync\ReadChannelInterface
Constants (3)
| Name | Value |
|---|---|
READY |
0 |
BLOCKING_READS |
1 |
BLOCKING_WRITES |
2 |
Properties (8)
array $waiting
Waiting fibers in all channels are stored in a static array, because
int $id
bool $closed
mixed $value
Fiber $creatingFiber
object $flag
int $state
Channels are either blocking reads or writes. When the channel is in
Fiber $receiver
When a channel reads a message from a blocked writer, it temporarily
Methods (16)
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing