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:

  1. Load through ptr to get the original value
  2. Get a new value from value only if the original value equals comparator, and
  3. Store the new value back through ptr, only if the original value equaled comparator.

The result is the original value.