Esempio n. 1
0
 /**
  * @param \Icicle\Loop\SelectLoop $loop
  * @param \Icicle\Loop\Events\EventFactoryInterface $factory
  */
 public function __construct(SelectLoop $loop, EventFactoryInterface $factory)
 {
     parent::__construct($loop, $factory);
     $callback = $this->createSignalCallback();
     foreach ($this->getSignalList() as $signal) {
         pcntl_signal($signal, $callback);
     }
 }
Esempio n. 2
0
 /**
  * @param \Icicle\Loop\EventLoop $loop
  * @param \Icicle\Loop\Events\EventFactoryInterface $factory
  */
 public function __construct(EventLoop $loop, EventFactoryInterface $factory)
 {
     parent::__construct($loop, $factory);
     $callback = $this->createSignalCallback();
     $base = $loop->getEventBase();
     foreach ($this->getSignalList() as $signal) {
         $event = new Event($base, $signal, Event::SIGNAL | Event::PERSIST, $callback);
         $event->add();
         $this->events[$signal] = $event;
     }
 }
Esempio n. 3
0
 /**
  * @param \Icicle\Loop\EvLoop $loop
  * @param \Icicle\Loop\Events\EventFactoryInterface $factory
  */
 public function __construct(EvLoop $loop, EventFactoryInterface $factory)
 {
     parent::__construct($loop, $factory);
     $callback = $this->createSignalCallback();
     $callback = function (\EvSignal $event) use($callback) {
         $callback($event->signum);
     };
     $loop = $loop->getEvLoop();
     foreach ($this->getSignalList() as $signal) {
         $event = $loop->signal($signal, $callback);
         $this->events[$signal] = $event;
     }
 }
Esempio n. 4
0
 /**
  * @param \Icicle\Loop\LoopInterface $loop
  * @param \Icicle\Loop\Events\EventFactoryInterface $factory
  * @param resource $base
  */
 public function __construct(LibeventLoop $loop, EventFactoryInterface $factory)
 {
     parent::__construct($loop, $factory);
     $callback = $this->createSignalCallback();
     $base = $loop->getEventBase();
     foreach ($this->getSignalList() as $signo) {
         $event = event_new();
         event_set($event, $signo, EV_SIGNAL | EV_PERSIST, $callback);
         event_base_set($event, $base);
         event_add($event);
         $this->events[$signo] = $event;
     }
 }
Esempio n. 5
0
 /**
  * @param \Icicle\Loop\UvLoop $loop
  * @param \Icicle\Loop\Events\EventFactoryInterface $factory
  */
 public function __construct(UvLoop $loop, EventFactoryInterface $factory)
 {
     parent::__construct($loop, $factory);
     $loopHandle = $loop->getLoopHandle();
     $signalCallback = $this->createSignalCallback();
     $callback = function ($sigHandle, int $signo) use($signalCallback) {
         $signalCallback($signo);
     };
     foreach ($this->getSignalList() as $signo) {
         $sigHandle = \uv_signal_init($loopHandle);
         \uv_signal_start($sigHandle, $callback, $signo);
         $this->sigHandles[$signo] = $sigHandle;
     }
 }