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