function AbstractDriver::invokeMicrotasks
1 call to AbstractDriver::invokeMicrotasks()
- AbstractDriver::createCallbackFiber in vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php, line 418
Class
- AbstractDriver
- Event loop driver which implements all basic operations to allow interoperability.
Namespace
Revolt\EventLoop\InternalCode
private function invokeMicrotasks() : void {
while (!$this->microtaskQueue
->isEmpty()) {
[
$callback,
$args,
] = $this->microtaskQueue
->dequeue();
try {
// Clear $args to allow garbage collection
$callback(...$args, ...$args = []);
} catch (\Throwable $exception) {
$this->error($callback, $exception);
} finally {
FiberLocal::clear();
}
unset($callback, $args);
if ($this->interrupt) {
/** @noinspection PhpUnhandledExceptionInspection */
\Fiber::suspend($this->internalSuspensionMarker);
}
}
}