From 4a3e85f028f6938bd61bd21cce55ca723924b558 Mon Sep 17 00:00:00 2001 From: Charlotte Dunois Date: Mon, 14 Jan 2019 11:52:07 +0100 Subject: [PATCH] Add async signal dispatching if available --- src/StreamSelectLoop.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/StreamSelectLoop.php b/src/StreamSelectLoop.php index 625b6fb6..3e6ff07f 100644 --- a/src/StreamSelectLoop.php +++ b/src/StreamSelectLoop.php @@ -62,6 +62,7 @@ final class StreamSelectLoop implements LoopInterface private $writeListeners = array(); private $running; private $pcntl = false; + private $pcntlActive = false; private $signals; public function __construct() @@ -69,7 +70,12 @@ public function __construct() $this->futureTickQueue = new FutureTickQueue(); $this->timers = new Timers(); $this->pcntl = \extension_loaded('pcntl'); + $this->pcntlActive = $this->pcntl && !\function_exists('pcntl_async_signals'); $this->signals = new SignalsHandler(); + + if ($this->pcntl && !$this->pcntlActive) { + \pcntl_async_signals(true); + } } public function addReadStream($stream, $listener) @@ -222,7 +228,7 @@ private function waitForStreamActivity($timeout) $write = $this->writeStreams; $available = $this->streamSelect($read, $write, $timeout); - if ($this->pcntl) { + if ($this->pcntlActive) { \pcntl_signal_dispatch(); } if (false === $available) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy