/**
  * @param SignalEvent $event
  */
 public function stop(SignalEvent $event)
 {
     if (!in_array($event->data()['signal'], [SIGTERM, SIGINT])) {
         return;
     }
     $event->getLoop()->stop();
 }
예제 #2
0
 /**
  * @param WebsocketStartEvent $event
  */
 public function start(WebsocketStartEvent $event)
 {
     $this->pcntl = new PCNTL($event->getLoop());
     foreach ($this->signals as $signal) {
         $this->pcntl->on($signal, function ($signal) use($event) {
             EventManager::instance()->dispatch(SignalEvent::create($event->getLoop(), $signal));
         });
     }
 }