Skip to content

Commit 897149a

Browse files
committed
fence docs: fix example Mutex
1 parent 06e7b93 commit 897149a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/sync/atomic.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2649,7 +2649,8 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
26492649
/// }
26502650
///
26512651
/// pub fn lock(&self) {
2652-
/// while !self.flag.compare_and_swap(false, true, Ordering::Relaxed) {}
2652+
/// // Wait until the old value is `false`.
2653+
/// while self.flag.compare_and_swap(false, true, Ordering::Relaxed) != false {}
26532654
/// // This fence synchronizes-with store in `unlock`.
26542655
/// fence(Ordering::Acquire);
26552656
/// }

0 commit comments

Comments
 (0)