c/atomic/atomic exchange

Atomically replaces the value pointed by with  and returns the value  held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to.

.

Return value
The value held previously be the atomic object pointed to by.