An integer that may safely be used on different threads without external locking.
On Win32, Linux, FreeBSD, and Mac OS X this is implemented without locks.
BETA API This is unsupported and may change
Atomic test-and-set: if *this == comperand
then *this := exchange
else do nothing. In both cases, returns the old value of *this
.
Performs an atomic comparison of this with the Comperand value. If this is equal to the Comperand value, the Exchange value is stored in this. Otherwise, no operation is performed.
Under VC6 the sign bit may be lost.
143 # if defined(G3D_WINDOWS)
144 return InterlockedCompareExchange(&
m_value, exchange, comperand);
145 # elif defined(G3D_LINUX) || defined(G3D_FREEBSD) || defined(G3D_OSX)
149 asm volatile (
"lock; cmpxchgl %1, %2"
151 :
"r" (exchange),
"m" (
m_value),
"0"(comperand)
volatile int32 m_value
Definition: AtomicInt32.h:36
int32_t int32
Definition: Define.h:146