Skip to content

Commit 5875657

Browse files
committed
Fix comment about non-reentrant StaticMutex::lock().
The comment said it's UB to call lock() while it is locked. That'd be quite a useless Mutex. :) It was supposed to say 'locked by the same thread', not just 'locked'.
1 parent 31e4087 commit 5875657

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/std/src/sys_common/mutex.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ impl StaticMutex {
2828
/// Calls raw_lock() and then returns an RAII guard to guarantee the mutex
2929
/// will be unlocked.
3030
///
31-
/// It is undefined behaviour to call this function while locked, or if the
32-
/// mutex has been moved since the last time this was called.
31+
/// It is undefined behaviour to call this function while locked by the
32+
/// same thread, or if the mutex has been moved since the last time this
33+
/// was called.
3334
#[inline]
3435
pub unsafe fn lock(&self) -> StaticMutexGuard<'_> {
3536
self.0.lock();

0 commit comments

Comments
 (0)