Function
atomicCas
Compare-and-Swap operation.
Include Headers
seqan/parallel.h
Parameters
Pointer to the integer to swap. | |
Value to compare | |
Value to set |
Remarks
The pseudo code for this is
On Windows, atomic CAS is only available for 16, 32, and 64 bit integers, 64 bit is only available on 64 bit Windows.
You are responsible for correctly aligning x such that the atomic increment works on the hardware you target.
{
T val = *(&x);
if (val == cmp)
*(&x) = y;
return val;
}
SeqAn - Sequence Analysis Library - www.seqan.de