Atomic.intCompareAndExchange

Compares oldval with the integer pointed to by atomic and if they are equal, atomically exchanges *atomic with newval. Also acts as a memory barrier. Since 2.4

class Atomic
static
int
intCompareAndExchange
(
int* atomic
,
int oldval
,
int newval
)

Parameters

atomic int*

a pointer to an integer

oldval int

the assumed old value of *atomic

newval int

the new value of *atomic

Return Value

Type: int

TRUE, if *atomic was equal oldval. FALSE otherwise.

Meta