Conditionally swap this pointer with acquire/release ordering.
Synopsis
Declared in <bsls_atomic.h>
TYPE*
testAndSwapAcqRel(
TYPE const* compareValue,
TYPE* swapValue);
Description
Compare the value of this object to the specified compareValue. If they are equal, set the value of this atomic pointer to the specified swapValue, otherwise leave this value unchanged. Return the previous value of this atomic pointer, whether or not the swap occurred. Note that the entire test‐and‐swap operation is performed atomically and it provides the acquire/release memory ordering guarantee.
Return Value
previous value of this object
Parameters
Name |
Description |
compareValue |
expected current value of this object |
swapValue |
pointer to store if the comparison succeeds |
Created with MrDocs