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.
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
process: use blocking threadpool for child stdio I/O #4824
process: use blocking threadpool for child stdio I/O #4824
Changes from all commits
9f03276
74a78e6
f5c23b1
065f28d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like you could drop the
Arc
stuff if you just stored the raw handle next to theio
field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::process::Stdio
wants ownership of the handle (and will close it on drop) which might cause issues if the handle is still being written to in the background. Using the Arc allows us to potentially avoid a syscall to duplicate the handle if it doesn't have any pending I/O on itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could implement a
try_unwrap
on theBlocking
type to get the same behavior without theArc
. But I don't mind either way, so I will approve it and let you decide if you want to implement that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did consider adding
try_unwrap
toBlocking
, the tricky bit is that it moves the handle to and from the blocking threadpool, so if there is a pending I/O operation we cannot access anything. The conversion fromChildStd*
toStdio
are synchronous, so we cannot even internally.await
things. Hence theArc
approach allows us to at least clone the handle if neededI'm going to leave it as is for now since we can always revisit it later as needed. Thanks for the review!