about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-29 16:38:31 -0700
committerGitHub <noreply@github.com>2020-07-29 16:38:31 -0700
commit20501283029cfe25a7d29b4434915a2aa35ce0d8 (patch)
tree2db6bb71f77b0b3e4e5e5296b765887b063cc384
parent1d53340e041c74b3b38dec0011305a36d3f7a9fd (diff)
parent897149a88323f0b5b9bc16e9b41b39cbc3bdae0e (diff)
downloadrust-20501283029cfe25a7d29b4434915a2aa35ce0d8.tar.gz
rust-20501283029cfe25a7d29b4434915a2aa35ce0d8.zip
Rollup merge of #74910 - RalfJung:fence, r=Mark-Simulacrum
fence docs: fix example Mutex

Fixes https://github.com/rust-lang/rust/issues/74808

Cc @pca006132
-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);
 ///     }