Lines Matching defs:cmpxchg
385 /// failed cmpxchg is a [`Relaxed`] load.
387 /// Returns `Ok(value)` if cmpxchg succeeds, and `value` is guaranteed to be equal to `old`,
397 /// // Checks whether cmpxchg succeeded.
398 /// let success = x.cmpxchg(52, 64, Relaxed).is_ok();
401 /// // Checks whether cmpxchg failed.
402 /// let failure = x.cmpxchg(52, 64, Relaxed).is_err();
405 /// // Uses the old value if failed, probably re-try cmpxchg.
406 /// match x.cmpxchg(52, 64, Relaxed) {
415 /// let latest = x.cmpxchg(42, 64, Full).unwrap_or_else(|old| old);
429 pub fn cmpxchg<Ordering: ordering::Ordering>(
437 // try_cmpxchg() is used to implement cmpxchg(), and if the helper functions are inlined,
442 // success of cmpxchg and only wants to use the old value. For example, for code like:
444 // let latest = x.cmpxchg(42, 64, Full).unwrap_or_else(|old| old);
472 /// "Compare" and "Ordering" part are the same as [`Atomic::cmpxchg()`].
474 /// Returns `true` means the cmpxchg succeeds otherwise returns `false`.
671 /// (RMW) operations (e.g. [`Atomic::xchg()`]/[`Atomic::cmpxchg()`]) or when [`Atomic<bool>`] does
735 pub fn cmpxchg<Ordering: ordering::Ordering>(
741 match self.0.cmpxchg(Flag::new(old), Flag::new(new), o) {
828 /// This function provides a short-cut of `Atomic::from_ptr().cmpxchg(..)`, and can be used to work
837 pub unsafe fn cmpxchg<T: AtomicType, Ordering: ordering::Ordering>(
849 unsafe { Atomic::from_ptr(ptr) }.cmpxchg(old, new, o)