Stores value in dest and returns what was there before.
x := 1;
old := atomic_swap(*x, 2);
assert(old == 1 && x == 2);atomic_swap :: atomic_exchange
Stores value in dest and returns what was there before.
x := 1;
old := atomic_swap(*x, 2);
assert(old == 1 && x == 2);atomic_swap :: atomic_exchange