Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function disableSignalWatcher(SignalWatcher $watcher, bool $dispose = false)
 {
     if ($watcher->event === null) {
         return;
     }
     unset($this->signalWatchers[$watcher->signo][$watcher->id]);
     if (empty($this->signalWatchers[$watcher->signo])) {
         unset($this->signalWatchers[$watcher->signo]);
         if (\uv_is_active($watcher->event)) {
             \uv_signal_stop($watcher->event);
         }
     }
     if ($dispose) {
         try {
             if ($this->dispatching) {
                 $this->dispose->enqueue($watcher->event);
             } else {
                 \uv_close($watcher->event);
             }
         } finally {
             $watcher->event = null;
         }
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function isPending(Io $io) : bool
 {
     $id = (int) $io->getResource();
     return isset($this->sockets[$id], $this->polls[$id]) && $io === $this->sockets[$id] && \uv_is_active($this->polls[$id]);
 }