phasync\Drivers\StreamSelectDriver final class

Documentation

Documentation missing - No docblock found for this class.

Inheritance

Implements: phasync\Drivers\DriverInterface Countable

Constants (4)

NameValue
STREAM_READ 1
STREAM_WRITE 2
STREAM_EXCEPT 4
SUSPEND_TICK 0

Properties (21)

private SplQueue $queue

Holds the queue of fibers that will be activated on the next

private WeakMap $contexts

Holds a reference to all Fiber that are created by this driver.

private SplObjectStorage $pending

Holds a reference to all fibers that will be resumed by this event

private WeakMap $parentFibers

Maps child fibers to their parent fibers, unless the fiber

private WeakMap $fiberExceptionHolders

Exceptions to be thrown inside a fiber, or exceptions that

private WeakMap $fiberExceptions

When an exception is caught from the exception holder, it is

private phasync\Internal\Scheduler $scheduler

A min-heap that provides fast access to the next fiber to be

private WeakMap $streams

All fibers suspended waiting for IO.

private WeakMap $streamResults

The most recent stream select result for a fiber.

private WeakMap $flaggedFibers

Holds a reference to fibers that are waiting for a flag to be

private float $lastTimeoutCheck

The time of the last timeout check iteration. This value is used

private float $lastIdleRun

The time that we last activated tasks waiting for idle. Tasks waiting

public WeakMap $flagGraph

This WeakMap traces which flag a fiber is waiting for.

private bool $shouldGarbageCollect

True if cyclic garbage collection should be performed.

private SplQueue $callbackQueue

Callbacks to be invoked between fibers.

private float $lastGarbageCollect

The time since the last garbage collect cycles invoked.

private phasync\Context\ServiceContext $serviceContext
private stdClass $idleFlag
private stdClass $afterNextFlag
private ?Fiber $currentFiber
private ?phasync\Context\ContextInterface $currentContext

Methods (27)

Create a new StreamSelectDriver instance.

Documentation missing

Returns the full internal state of the driver for debugging purposes.

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Returns true if `$fiber` is blocked by `$flag`. If `$flag` is a

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Removes a fiber from the event loop completely, without throwing any exception.

Gets the exception for a terminated fiber and returns the ExceptionHolder instance

Returns the fiber that is currently being executed by the driver.

Returns the context of the currently executing fiber.

Scans pending fibers and cancels any that have exceeded their timeout.

To ensure that no exceptions will be lost, an ExceptionHolder class is used.

Whenever a fiber is terminated, this method must be used. It will ensure that any

Source

src/Drivers/StreamSelectDriver.php:19-830