Skip to content

Commit

Permalink
small improvements in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique committed Feb 27, 2024
1 parent dd1995c commit 5bb6aa6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,13 @@ mod tests {
let guard1 = lock1.try_lock()?;
assert!(matches!(lock2.try_lock(), Err(Error::WouldBlock)));

// If `NamedLockGuard` is still alive the lock must stay locked
// Dropping `lock1` should not affect the state of the lock.
// If `guard1` is not dropped the lock must stay locked.
drop(lock1);
assert!(matches!(lock2.try_lock(), Err(Error::WouldBlock)));

// Unlock by dropping the guard
// Unlock by dropping the `guard1`
drop(guard1);

// Now locking will succeed
let _guard2 = lock2.try_lock()?;

Ok(())
Expand Down

0 comments on commit 5bb6aa6

Please sign in to comment.