-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
condition_variable_any with stop_token: Unlock inner mutex before relocking outer mutex #2220
condition_variable_any with stop_token: Unlock inner mutex before relocking outer mutex #2220
Conversation
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.
LGTM. I audited the other wait
functions looking for similar occurrences, but found no others.
Agreed we must actually unlock the lock when the timeout has expired (See #369). |
I'm mirroring this to an MSVC-internal PR; please notify me if any further changes are pushed. |
Thanks for robustly fixing this deadlock! 🧟 ☠️ 🎃 |
…#2220) Co-authored-by: Stephan T. Lavavej <[email protected]>
Fix #2218
I think we can't move
_Unlock_outer
after checking for time expiration, as the Standard wants us to unlock outer mutex as the first step, and this is visible forcondition_variable_any
. If we could, this would have been certainly a better fix.