MMK
1
Documentation:Mutex::lock in std::sync - Rust
it says that
Panics
This function might panic when called if the lock is already held by the current thread.
But in fact, it's not true:
the program runs indefinitely.
It's really incomprehensible behavior for me, maybe I don't understand something?
H2CO3
2
It says
It doesn't say it will panic.
Like, literally two lines earlier, it says that
The exact behavior on locking a mutex in the thread which already holds the lock is left unspecified.
So, it's explicitly not guaranteed to panic.
3 Likes
system
Closed
5
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.