From 7f9b6c0ced47933a4c25b8ae1ca6506c0ebe6b97 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 8 Jun 2019 18:05:27 +0200 Subject: [PATCH] Do not automatically enable async signal handling --- lib/Loop/NativeDriver.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Loop/NativeDriver.php b/lib/Loop/NativeDriver.php index 0316912..29e4e03 100644 --- a/lib/Loop/NativeDriver.php +++ b/lib/Loop/NativeDriver.php @@ -50,7 +50,7 @@ class NativeDriver extends Driver { $this->timerQueue = new Internal\TimerQueue; $this->signalHandling = \extension_loaded("pcntl"); - $this->manualSignalHandling = PHP_VERSION_ID < 70100; + $this->manualSignalHandling = PHP_VERSION_ID < 70100 || !\pcntl_async_signals(); $this->nowOffset = getCurrentTime(); $this->now = \random_int(0, $this->nowOffset); $this->nowOffset -= $this->now; @@ -66,9 +66,7 @@ class NativeDriver extends Driver if (!$this->signalHandling) { throw new UnsupportedFeatureException("Signal handling requires the pcntl extension"); } - if (!$this->manualSignalHandling && !\pcntl_async_signals()) { - \pcntl_async_signals(true); - } + $this->manualSignalHandling = PHP_VERSION_ID < 70100 || !\pcntl_async_signals(); return parent::onSignal($signo, $callback, $data); }