Conditionally swap this value if it equals compareValue.
Declared in <bsls_atomic.h>
unsigned int
testAndSwap(
unsigned int compareValue,
unsigned int swapValue);
Compare the value of this object to the specified compareValue. If they are equal, set the value of this atomic unsigned integer to the specified swapValue, otherwise leave this value unchanged. Return the previous value of this atomic unsigned integer, whether or not the swap occurred. Note that the entire test-and-swap operation is performed atomically.
previous value of this object
| Name | Description |
|---|---|
| compareValue | expected current value of this object |
| swapValue | value to store if the comparison succeeds |