summaryrefslogtreecommitdiff
path: root/src/lock.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lock.rs')
-rw-r--r--src/lock.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lock.rs b/src/lock.rs
index a8662d0..f310099 100644
--- a/src/lock.rs
+++ b/src/lock.rs
@@ -53,7 +53,7 @@ impl Lock {
/// repeatedly in a loop.
pub fn try_lock(&self) -> Option<Key> {
// safety: we just acquired the lock
- (!self.is_locked.fetch_or(true, Ordering::Acquire)).then_some(unsafe { Key::new(self) })
+ (!self.is_locked.swap(true, Ordering::Acquire)).then_some(unsafe { Key::new(self) })
}
/// Forcibly unlocks the `Lock`.