pub unsafe fn atomic_compare_exchange<I: Integer, const SCOPE: u32, const EQUAL: u32, const UNEQUAL: u32>(
ptr: &mut I,
value: I,
comparator: I,
) -> I
Expand description
Perform the following steps atomically with respect to any other atomic
accesses within SCOPE
to the same location:
- Load through
ptr
to get the original value - Get a new value from
value
only if the original value equalscomparator
, and - Store the new value back through
ptr
, only if the original value equaledcomparator
.
The result is the original value.