-
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
Add a comment about locking a Mutex
multiple times
#33034
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
A guarantee that we can provide here is that a recursive call to |
@alexcrichton Updated. |
@@ -205,10 +205,19 @@ impl<T: ?Sized> Mutex<T> { | |||
/// held. An RAII guard is returned to allow scoped unlock of the lock. When | |||
/// the guard goes out of scope, the mutex will be unlocked. | |||
/// | |||
/// The exact behavior on locking a mutex twice in the same thread is left |
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.
“locking a mutex twice” is ambiguous in whether 2nd lock happens with mutex being locked or unlocked.
I would reword this as “behaviour of locking the mutex in the thread which already holds the lock is left unspecified” instead.
@nagisa Sounds good. Changed. |
📌 Commit df748bf has been approved by |
Add a comment about locking a `Mutex` multiple times Fixes #32260.
Fixes #32260.