-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
park/park_timeout: prohibit spurious wakeups in next park #51290
Conversation
should consume this notification, so prohibit spurious wakeups in next park
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
remove trailing whitespace
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
r? @SimonSapin perhaps? Not sure who knows this code well. |
Friendly triage ping, @SimonSapin / @rust-lang/libs, could you review that PR or assign someone more familiar with this code? |
Sorry, I’m not confident about my understanding of this code. The winner of the git-shortlog lottery is… (Unfortunately he’s away for the next few weeks.) |
📌 Commit b352d2d has been approved by |
park/park_timeout: prohibit spurious wakeups in next park <pre><code> // The implementation currently uses the trivial strategy of a Mutex+Condvar // with wakeup flag, which does not actually allow spurious wakeups. </pre></code> Because does not actually allow spurious wakeups. so we have let thread.inner.cvar.wait(m) in the loop to prohibit spurious wakeups. but if notified after we locked, this notification doesn't be consumed, it return, the next park will consume this notification...this is also 'spurious wakeup' case, 'one unpark() wakeups two park()'. We should improve this situation: `thread.inner.state.store(EMPTY, SeqCst);`
☀️ Test successful - status-appveyor, status-travis |
Because does not actually allow spurious wakeups.
so we have let thread.inner.cvar.wait(m) in the loop to prohibit spurious wakeups.
but if notified after we locked, this notification doesn't be consumed, it return, the next park will consume this notification...this is also 'spurious wakeup' case, 'one unpark() wakeups two park()'.
We should improve this situation:
thread.inner.state.store(EMPTY, SeqCst);