Documentation:Mutex::lock in std::sync - Rust
it says that
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?
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.
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.