about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-07-29 15:44:19 +0200
committerRalf Jung <post@ralfj.de>2020-07-29 15:45:42 +0200
commit897149a88323f0b5b9bc16e9b41b39cbc3bdae0e (patch)
tree505a729551ff053bfb9959c369e4e2f778a7821f
parent06e7b93f6a2a3eeaf80fd6a9a3ef7b180bb5d778 (diff)
downloadrust-897149a88323f0b5b9bc16e9b41b39cbc3bdae0e.tar.gz
rust-897149a88323f0b5b9bc16e9b41b39cbc3bdae0e.zip
fence docs: fix example Mutex
-rw-r--r--library/core/src/sync/atomic.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
index fcae6c86774..f31a4a0b751 100644
--- a/library/core/src/sync/atomic.rs
+++ b/library/core/src/sync/atomic.rs
@@ -2649,7 +2649,8 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
 ///     }
 ///
 ///     pub fn lock(&self) {
-///         while !self.flag.compare_and_swap(false, true, Ordering::Relaxed) {}
+///         // Wait until the old value is `false`.
+///         while self.flag.compare_and_swap(false, true, Ordering::Relaxed) != false {}
 ///         // This fence synchronizes-with store in `unlock`.
 ///         fence(Ordering::Acquire);
 ///     }