Change interface to AtomicCompareAndSwap
The interface for AtomicComapreAndSwap
(and similar methods) differs from the standard C++ library in that it puts the desired parameter before the expected parameter. This makes it error-prone to use these methods.
Instead, depreciate this old signature. Reconfigure the methods to put the expected parameter first. Also change the expected parameter to be a pass-by-address to make it harder to mess it up.
Also consider changing the names from CompareAndSwap
to CompareExchange
. (This is not strictly necessary since the C++ overloads should provide enough distinction.)