function AbstractDriver::tick
Executes a single tick of the event loop.
1 call to AbstractDriver::tick()
- AbstractDriver::createLoopFiber in vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php, line 458
Class
- AbstractDriver
- Event loop driver which implements all basic operations to allow interoperability.
Namespace
Revolt\EventLoop\InternalCode
private function tick(bool $previousIdle) : void {
$this->activate($this->enableQueue);
foreach ($this->enableQueue as $callback) {
$callback->invokable = true;
}
$this->enableQueue = [];
foreach ($this->enableDeferQueue as $callback) {
$callback->invokable = true;
$this->enqueueCallback($callback);
}
$this->enableDeferQueue = [];
$blocking = $previousIdle && !$this->stopped && !$this->isEmpty();
if ($blocking) {
$this->invokeCallbacks();
/** @psalm-suppress TypeDoesNotContainType */
if (!empty($this->enableDeferQueue) || !empty($this->enableQueue)) {
$blocking = false;
}
}
/** @psalm-suppress RedundantCondition */
$this->dispatch($blocking);
}