-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Never panic in thread::park
and thread::park_timeout
#102412
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
Wouldn't not parking the thread if some underlying resource can't be acquired be a valid strategy? After all park is allowed to wake up any time, similar to condvars. So instead of panicing it would return immediately. |
@the8472 Yes, but if the error keeps occuring, that'd effectively turn a park-loop into a spin-loop, which is pretty bad. |
Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Yes, definitely, and this is still valid behaviour. However, since implementing that would impact so many different areas (TLS for instance), I doubt that it is really worth it, as errors should be extremely rare here. |
What about eagerly allocating the resources when creating the thread? |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
That doesn't prevent all possible panics. We can't guarantee that e.g. the underlying libc calls always succeed. See #102398 (comment) |
@bors r+ |
Never panic in `thread::park` and `thread::park_timeout` fixes rust-lang#102398 ``@rustbot`` label +T-libs +T-libs-api
Rollup of 7 pull requests Successful merges: - rust-lang#102258 (Remove unused variable in float formatting.) - rust-lang#102277 (Consistently write `RwLock`) - rust-lang#102412 (Never panic in `thread::park` and `thread::park_timeout`) - rust-lang#102589 (scoped threads: pass closure through MaybeUninit to avoid invalid dangling references) - rust-lang#102625 (fix backtrace small typo) - rust-lang#102859 (Move lifetime resolution module to rustc_hir_analysis.) - rust-lang#102898 (rustdoc: remove unneeded `<div>` wrapper from sidebar DOM) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
fixes #102398
@rustbot label +T-libs +T-libs-api