8000 Merge pull request #265 from clue-labs/eintr-pcntl · reactphp/event-loop@21914ff · GitHub
[go: up one dir, main page]

Skip to content

Commit 21914ff

Browse files
authored
Merge pull request #265 from clue-labs/eintr-pcntl
Support checking `EINTR` constant from `ext-pcntl` without `ext-sockets`
2 parents 747a470 + 05225dc commit 21914ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/StreamSelectLoop.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ private function streamSelect(array &$read, array &$write, $timeout)
290290
/** @var ?callable $previous */
291291
$previous = \set_error_handler(function ($errno, $errstr) use (&$previous) {
292292
// suppress warnings that occur when `stream_select()` is interrupted by a signal
293-
$eintr = \defined('SOCKET_EINTR') ? \SOCKET_EINTR : 4;
293+
// PHP defines `EINTR` through `ext-sockets` or `ext-pcntl`, otherwise use common default (Linux & Mac)
294+
$eintr = \defined('SOCKET_EINTR') ? \SOCKET_EINTR : (\defined('PCNTL_EINTR') ? \PCNTL_EINTR : 4);
294295
if ($errno === \E_WARNING && \strpos($errstr, '[' . $eintr .']: ') !== false) {
295296
return;
296297
}

0 commit comments

Comments
 (0)
0