/** * @param \Icicle\Loop\EventLoop $loop * @param int $eventType */ public function __construct(EventLoop $loop, $eventType) { $this->loop = $loop; $this->base = $this->loop->getEventBase(); $this->type = $eventType; $this->callback = function ($resource, $what, Io $io) { $io->call(0 !== (Event::TIMEOUT & $what)); }; }
/** * @param \Icicle\Loop\EventLoop $loop * @param \Icicle\Loop\Events\EventFactoryInterface $factory */ public function __construct(EventLoop $loop, EventFactoryInterface $factory) { $this->loop = $loop; $this->factory = $factory; $this->base = $this->loop->getEventBase(); $this->callback = function ($resource, $what, SocketEventInterface $socket) { $socket->call(0 !== (Event::TIMEOUT & $what)); }; }
/** * @param \Icicle\Loop\EventLoop $loop */ public function __construct(EventLoop $loop) { $this->loop = $loop; $this->base = $this->loop->getEventBase(); $this->timers = new ObjectStorage(); $this->callback = function ($resource, $what, Timer $timer) { if (!$this->timers[$timer]->pending) { $this->timers[$timer]->free(); unset($this->timers[$timer]); } $timer->call(); }; }
/** * @param bool $enableSignals True to enable signal handling, false to disable. * * @return \Icicle\Loop\LoopInterface * * @codeCoverageIgnore */ function create(bool $enableSignals = true) : LoopInterface { if (EvLoop::enabled()) { return new EvLoop($enableSignals); } if (EventLoop::enabled()) { return new EventLoop($enableSignals); } if (LibeventLoop::enabled()) { return new LibeventLoop($enableSignals); } return new SelectLoop($enableSignals); }