atomicIntExchange

Sets the atomic to newval and returns the old value from atomic.

This exchange is done atomically.

Think of this operation as an atomic version of { tmp = *atomic; *atomic = val; return tmp; }.

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

int
atomicIntExchange
(
ref int atomic
,
int newval
)

Parameters

atomic int

a pointer to a #gint or #guint

newval int

the value to replace with

Return Value

Type: int

the value of atomic before the exchange, signed