function AbstractDriver::__construct
8 calls to AbstractDriver::__construct()
- EvDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ EvDriver.php - EvDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ EvDriver.php - EventDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ EventDriver.php - EventDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ EventDriver.php - StreamSelectDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ StreamSelectDriver.php
4 methods override AbstractDriver::__construct()
- EvDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ EvDriver.php - EventDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ EventDriver.php - StreamSelectDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ StreamSelectDriver.php - UvDriver::__construct in vendor/
revolt/ event-loop/ src/ EventLoop/ Driver/ UvDriver.php
File
-
vendor/
revolt/ event-loop/ src/ EventLoop/ Internal/ AbstractDriver.php, line 67
Class
- AbstractDriver
- Event loop driver which implements all basic operations to allow interoperability.
Namespace
Revolt\EventLoop\InternalCode
public function __construct() {
if (\PHP_VERSION_ID < 80117 || \PHP_VERSION_ID >= 80200 && \PHP_VERSION_ID < 80204) {
// PHP GC is broken on early 8.1 and 8.2 versions, see https://github.com/php/php-src/issues/10496
if (!\getenv('REVOLT_DRIVER_SUPPRESS_ISSUE_10496')) {
throw new \Error('Your version of PHP is affected by serious garbage collector bugs related to fibers. Please upgrade to a newer version of PHP, i.e. >= 8.1.17 or => 8.2.4');
}
}
$this->suspensions = new \WeakMap();
$this->internalSuspensionMarker = new \stdClass();
$this->microtaskQueue = new \SplQueue();
$this->callbackQueue = new \SplQueue();
$this->createLoopFiber();
$this->createCallbackFiber();
$this->createErrorCallback();
/** @psalm-suppress InvalidArgument */
$this->interruptCallback = $this->setInterrupt(...);
$this->queueCallback = $this->queue(...);
$this->runCallback = function () {
if ($this->fiber
->isTerminated()) {
$this->createLoopFiber();
}
return $this->fiber
->isStarted() ? $this->fiber
->resume() : $this->fiber
->start();
};
}