cpp/atomic/atomic/exchange

Atomically replaces the underlying value with (a read-modify-write operation). Memory is affected according to the value of.

Return value
The value of the atomic variable before the call.