diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2020-07-29 16:38:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-29 16:38:31 -0700 |
| commit | 20501283029cfe25a7d29b4434915a2aa35ce0d8 (patch) | |
| tree | 2db6bb71f77b0b3e4e5e5296b765887b063cc384 | |
| parent | 1d53340e041c74b3b38dec0011305a36d3f7a9fd (diff) | |
| parent | 897149a88323f0b5b9bc16e9b41b39cbc3bdae0e (diff) | |
| download | rust-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.rs | 3 |
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); /// } |
