-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce using non-blocking I/O #46
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following gist can be used to reproduce this issue: $loop = React\EventLoop\Factory::create();
// dummy timer to see some activity on STDOUT
$loop->addPeriodicTimer(1.0, function () {
echo microtime(true) . PHP_EOL;
});
// this will always return false on Windows
var_dump(stream_set_blocking(STDIN, false));
$loop->addReadStream(STDIN, function () {
// this will always block on Windows
fread(STDIN, 1024);
});
$loop->run(); See https://bugs.php.net/bug.php?id=47918 for details, there does not appear to be a way to circumvent this in PHP. |
Reading from a stream should *never* block the loop. This is known to be an issue for process pipes on Windows.
clue
changed the title
[RFC] Enforce using non-blocking I/O
Enforce using non-blocking I/O
Mar 8, 2017
Rebased on current master and added tests to ensure 100% coverage using a stream wrapper |
jsor
approved these changes
Mar 8, 2017
@clue Tests on hhvm are failing.
|
Thanks for spotting, updated to fix tests on HHVM |
jsor
approved these changes
Mar 9, 2017
WyriHaximus
approved these changes
Mar 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Opening this an RFC, any input is welcome! 👍
Reading from a stream should never block the loop.
This is known to be an issue for process pipes on Windows.
Refs: reactphp/child-process#9 and reactphp/reactphp#68