Inheritance: implements Icicle\Loop\Loop
Example #1
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \EvLoop|null $loop Use null for an EvLoop object to be automatically created.
  *
  * @throws \Icicle\Exception\UnsupportedError If the event extension is not loaded.
  */
 public function __construct(bool $enableSignals = true, \EvLoop $loop = null)
 {
     // @codeCoverageIgnoreStart
     if (!self::enabled()) {
         throw new UnsupportedError(__CLASS__ . ' requires the ev extension.');
     }
     // @codeCoverageIgnoreEnd
     $this->loop = $loop ?: new \EvLoop();
     parent::__construct($enableSignals);
 }
Example #2
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \Icicle\Loop\Events\EventFactoryInterface|null $eventFactory
  * @param \EventBase|null $base Use null for an EventBase object to be automatically created.
  *
  * @throws \Icicle\Loop\Exception\UnsupportedError If the event extension is not loaded.
  */
 public function __construct(bool $enableSignals = true, EventFactoryInterface $eventFactory = null, EventBase $base = null)
 {
     // @codeCoverageIgnoreStart
     if (!self::enabled()) {
         throw new UnsupportedError(__CLASS__ . ' requires the event extension.');
     }
     // @codeCoverageIgnoreEnd
     $this->base = $base ?: new EventBase();
     parent::__construct($enableSignals, $eventFactory);
 }
Example #3
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \Icicle\Loop\Events\EventFactoryInterface|null $eventFactory
  * @param \EvLoop|null $loop Use null for an EvLoop object to be automatically created.
  *
  * @throws \Icicle\Loop\Exception\UnsupportedError If the event extension is not loaded.
  */
 public function __construct($enableSignals = true, EventFactoryInterface $eventFactory = null, \EvLoop $loop = null)
 {
     // @codeCoverageIgnoreStart
     if (!extension_loaded('ev')) {
         throw new UnsupportedError(__CLASS__ . ' requires the ev extension.');
     }
     // @codeCoverageIgnoreEnd
     $this->loop = $loop ?: new \EvLoop();
     parent::__construct($enableSignals, $eventFactory);
 }
Example #4
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param resource|null $loop Resource created by uv_loop_new() or null to create a new event loop.
  *
  * @throws \Icicle\Exception\UnsupportedError If the uv extension is not loaded.
  */
 public function __construct(bool $enableSignals = true, $loop = null)
 {
     // @codeCoverageIgnoreStart
     if (!extension_loaded('uv')) {
         throw new UnsupportedError(__CLASS__ . ' requires the UV extension.');
     }
     // @codeCoverageIgnoreEnd
     // @codeCoverageIgnoreStart
     if (!is_resource($loop)) {
         $this->loopHandle = \uv_loop_new();
     } else {
         // @codeCoverageIgnoreEnd
         $this->loopHandle = $loop;
     }
     parent::__construct($enableSignals);
 }
Example #5
0
 /**
  * @param bool $enableSignals True to enable signal handling, false to disable.
  * @param \Icicle\Loop\Events\EventFactoryInterface|null $eventFactory
  * @param resource|null Resource created by event_base_new() or null to automatically create an event base.
  *
  * @throws \Icicle\Loop\Exception\UnsupportedError If the libevent extension is not loaded.
  */
 public function __construct($enableSignals = true, EventFactoryInterface $eventFactory = null, $base = null)
 {
     // @codeCoverageIgnoreStart
     if (!self::enabled()) {
         throw new UnsupportedError(__CLASS__ . ' requires the libevent extension.');
     }
     // @codeCoverageIgnoreEnd
     // @codeCoverageIgnoreStart
     if (!is_resource($base)) {
         $this->base = event_base_new();
     } else {
         // @codeCoverageIgnoreEnd
         $this->base = $base;
     }
     parent::__construct($enableSignals, $eventFactory);
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     parent::clear();
     if (null !== $this->signalTimer) {
         $this->signalTimer->stop();
         $this->signalTimer = $this->timer($this->signalTimer->getInterval(), true, [$this->signalManager, 'tick']);
         $this->signalTimer->unreference();
     }
 }