From 2d02d964f4eb6f21ad0c50b259ec6128630dce53 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Wed, 1 May 2019 12:08:52 -0500 Subject: [PATCH] Use Events::setBlocking() added to parallel extension --- lib/Context/Internal/ParallelHub.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/Context/Internal/ParallelHub.php b/lib/Context/Internal/ParallelHub.php index fe2c644..6345877 100644 --- a/lib/Context/Internal/ParallelHub.php +++ b/lib/Context/Internal/ParallelHub.php @@ -26,20 +26,16 @@ class ParallelHub extends ProcessHub parent::__construct(); $events = $this->events = new Events; - $this->events->setTimeout(0); + $this->events->setBlocking(false); $channels = &$this->channels; $this->watcher = Loop::repeat(self::EXIT_CHECK_FREQUENCY, static function () use (&$channels, $events): void { - try { - while ($event = $events->poll()) { - $id = (int) $event->source; - \assert(isset($channels[$id]), 'Channel for context ID not found'); - $channel = $channels[$id]; - unset($channels[$id]); - $channel->close(); - } - } catch (Timeout $exception) { - // Ignore poll timeout. + while ($event = $events->poll()) { + $id = (int) $event->source; + \assert(isset($channels[$id]), 'Channel for context ID not found'); + $channel = $channels[$id]; + unset($channels[$id]); + $channel->close(); } }); Loop::disable($this->watcher);