1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00

Do not automatically enable async signal handling

This commit is contained in:
Daniil Gentili 2019-06-08 18:05:27 +02:00
parent b58ef264c8
commit 7f9b6c0ced

View File

@ -50,7 +50,7 @@ class NativeDriver extends Driver
{ {
$this->timerQueue = new Internal\TimerQueue; $this->timerQueue = new Internal\TimerQueue;
$this->signalHandling = \extension_loaded("pcntl"); $this->signalHandling = \extension_loaded("pcntl");
$this->manualSignalHandling = PHP_VERSION_ID < 70100; $this->manualSignalHandling = PHP_VERSION_ID < 70100 || !\pcntl_async_signals();
$this->nowOffset = getCurrentTime(); $this->nowOffset = getCurrentTime();
$this->now = \random_int(0, $this->nowOffset); $this->now = \random_int(0, $this->nowOffset);
$this->nowOffset -= $this->now; $this->nowOffset -= $this->now;
@ -66,9 +66,7 @@ class NativeDriver extends Driver
if (!$this->signalHandling) { if (!$this->signalHandling) {
throw new UnsupportedFeatureException("Signal handling requires the pcntl extension"); throw new UnsupportedFeatureException("Signal handling requires the pcntl extension");
} }
if (!$this->manualSignalHandling && !\pcntl_async_signals()) { $this->manualSignalHandling = PHP_VERSION_ID < 70100 || !\pcntl_async_signals();
\pcntl_async_signals(true);
}
return parent::onSignal($signo, $callback, $data); return parent::onSignal($signo, $callback, $data);
} }