Function
atomicCas
Compare-and-Swap operation.
atomicCas(x, cmp, y)
Include Headers
seqan/parallel.h
Parameters

x | Pointer to the integer to swap.
cmp | Value to compare x with.
y | Value to set x to if it is equal to cmp.

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.
atomic
{
T val = *(&x);
if (val == cmp)
*(&x) = y;
return val;
}
See Also
atomicInc, atomicAdd, atomicXor, atomicDec, atomicOr
SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2014/10/13 16:12:57