Skip to content
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

Detect exit immediately if last process pipe is closed #58

Merged
merged 2 commits into from
Jan 18, 2018

Conversation

clue
Copy link
Member

@clue clue commented Jan 13, 2018

This PR introduces a simple check to see if the program is already known to be closed when the last process pipe is closed. This simple change improves "exit" detection significantly for most programs and does not cause a noticeable penalty for more advanced use cases.

Most programs do not explicitly close their STDIO handles and these will be closed implicitly when the program exits. Accordingly, we will now detect the "exit" event immediately without having to start a timer.

More advanced programs may close their STDIO handles explicitly while the program is still running. We continue to use a perodic timer to check the program state in this case.

Supersedes / closes #15, thanks @nicolas-grekas!

Copy link
Member

@WyriHaximus WyriHaximus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🇮🇹 !

@jsor jsor merged commit d2b7244 into reactphp:master Jan 18, 2018
@clue clue deleted the fast-exit branch January 18, 2018 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants