function AbstractDriver::createLoopFiber
2 calls to AbstractDriver::createLoopFiber()
- AbstractDriver::run in vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php - Run the event loop.
- AbstractDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php, line 531
Class
- AbstractDriver
- Event loop driver which implements all basic operations to allow interoperability.
Namespace
Revolt\EventLoop\InternalCode
private function createLoopFiber() : void {
$this->fiber = new \Fiber(function () : void {
$this->stopped = false;
// Invoke microtasks if we have some
$this->invokeCallbacks();
/** @psalm-suppress RedundantCondition $this->stopped may be changed by $this->invokeCallbacks(). */
while (!$this->stopped) {
if ($this->interrupt) {
$this->invokeInterrupt();
}
if ($this->isEmpty()) {
return;
}
$previousIdle = $this->idle;
$this->idle = true;
$this->tick($previousIdle);
$this->invokeCallbacks();
}
});
}