File tree 1 file changed +7
-1
lines changed
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
62
62
private $ writeListeners = array ();
63
63
private $ running ;
64
64
private $ pcntl = false ;
65
+ private $ pcntlActive = false ;
65
66
private $ signals ;
66
67
67
68
public function __construct ()
68
69
{
69
70
$ this ->futureTickQueue = new FutureTickQueue ();
70
71
$ this ->timers = new Timers ();
71
72
$ this ->pcntl = \extension_loaded ('pcntl ' );
73
+ $ this ->pcntlActive = $ this ->pcntl && !\function_exists ('pcntl_async_signals ' );
72
74
$ this ->signals = new SignalsHandler ();
75
+
76
+ if ($ this ->pcntl && !$ this ->pcntlActive ) {
77
+ \pcntl_async_signals (true );
78
+ }
73
79
}
74
80
75
81
public function addReadStream ($ stream , $ listener )
@@ -222,7 +228,7 @@ private function waitForStreamActivity($timeout)
222
228
$ write = $ this ->writeStreams ;
223
229
224
230
$ available = $ this ->streamSelect ($ read , $ write , $ timeout );
225
- if ($ this ->pcntl ) {
231
+ if ($ this ->pcntlActive ) {
226
232
\pcntl_signal_dispatch ();
227
233
}
228
234
if (false === $ available ) {
You can’t perform that action at this time.
0 commit comments