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
This commit is contained in:
Manish Goregaokar 2020-07-29 16:38:31 -07:00 committed by GitHub
commit 2050128302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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