pub unsafe fn cmpxchg<T: AtomicType, Ordering: Ordering>(
ptr: *mut T,
old: T,
new: T,
o: Ordering,
) -> Result<T, T>where
T::Repr: AtomicExchangeOps,Expand description
Atomic compare and exchange over raw pointers.
This function provides a short-cut of Atomic::from_ptr().cmpxchg(..), and can be used to work
with C side on synchronizations.
ยงSafety
ptris a valid pointer toTand aligned toalign_of::<T>().- If there is a concurrent access from kernel (C or Rust), it has to be atomic.