atomicIntCompareAndExchangeFull

Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs. In any case the value of atomic before this operation is stored in preval.

This compare and exchange is done atomically.

Think of this operation as an atomic version of { *preval = *atomic; if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }.

This call acts as a full compiler and hardware memory barrier.

See also glib.global.atomicIntCompareAndExchange

bool
atomicIntCompareAndExchangeFull
(
ref int atomic
,
int oldval
,
int newval
,
out int preval
)

Parameters

atomic int

a pointer to a #gint or #guint

oldval int

the value to compare with

newval int

the value to conditionally replace with

preval int

the contents of atomic before this operation

Return Value

Type: bool

true if the exchange took place