Skip to content

Commit

Permalink
Fix comment about non-reentrant StaticMutex::lock().
Browse files Browse the repository at this point in the history
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'.
  • Loading branch information
m-ou-se committed Oct 14, 2020
1 parent 31e4087 commit 5875657
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/std/src/sys_common/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ impl StaticMutex {
/// Calls raw_lock() and then returns an RAII guard to guarantee the mutex
/// will be unlocked.
///
/// It is undefined behaviour to call this function while locked, or if the
/// mutex has been moved since the last time this was called.
/// It is undefined behaviour to call this function while locked by the
/// same thread, or if the mutex has been moved since the last time this
/// was called.
#[inline]
pub unsafe fn lock(&self) -> StaticMutexGuard<'_> {
self.0.lock();
Expand Down

0 comments on commit 5875657

Please sign in to comment.