File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -62,14 +62,20 @@ final class StreamSelectLoop implements LoopInterface
6262 private $ writeListeners = array ();
6363 private $ running ;
6464 private $ pcntl = false ;
65+ private $ pcntlActive = false ;
6566 private $ signals ;
6667
6768 public function __construct ()
6869 {
6970 $ this ->futureTickQueue = new FutureTickQueue ();
7071 $ this ->timers = new Timers ();
7172 $ this ->pcntl = \extension_loaded ('pcntl ' );
73+ $ this ->pcntlActive = $ this ->pcntl && !\function_exists ('pcntl_async_signals ' );
7274 $ this ->signals = new SignalsHandler ();
75+
76+ if ($ this ->pcntl && !$ this ->pcntlActive ) {
77+ \pcntl_async_signals (true );
78+ }
7379 }
7480
7581 public function addReadStream ($ stream , $ listener )
@@ -222,7 +228,7 @@ private function waitForStreamActivity($timeout)
222228 $ write = $ this ->writeStreams ;
223229
224230 $ available = $ this ->streamSelect ($ read , $ write , $ timeout );
225- if ($ this ->pcntl ) {
231+ if ($ this ->pcntlActive ) {
226232 \pcntl_signal_dispatch ();
227233 }
228234 if (false === $ available ) {
You can’t perform that action at this time.
0 commit comments