Exchanges the value of an atomic variable.
This method is thread-safe. Implements a full memory barrier.