unsafe fn atomic_compare_exchange_weak<T>(
    dst: *mut T,
    current: T,
    new: T,
) -> Result<T, T>
where T: Copy + Eq,
Expand description

Atomically compares data at dst to current and, if equal byte-for-byte, exchanges data at dst with new.

Returns the old value on success, or the current value at dst on failure.

This operation uses the AcqRel ordering. If possible, an atomic instructions is used, and a global lock otherwise.