TypeScript API Documentation for GLIB
API Version: 2.0
Library Version: 2.86.4
Generated with TypeDoc via ts-for-gir v4.0.0-beta.40
Since 2.4
Compares atomic to oldval and, if equal, sets it to newval. If atomic was not equal to oldval then no change occurs.
atomic
oldval
newval
This compare and exchange is done atomically.
Think of this operation as an atomic version of { if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }.
{ if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }
This call acts as a full compiler and hardware memory barrier.
While atomic has a volatile qualifier, this is a historical artifact and the pointer passed to it should not be volatile.
volatile
a pointer to a gpointer-sized value
gpointer
Optional
the value to compare with
the value to conditionally replace with
true if the exchange took place
true
2.4
Compares
atomictooldvaland, if equal, sets it tonewval. Ifatomicwas not equal tooldvalthen no change occurs.This compare and exchange is done atomically.
Think of this operation as an atomic version of
{ if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }.This call acts as a full compiler and hardware memory barrier.
While
atomichas avolatilequalifier, this is a historical artifact and the pointer passed to it should not bevolatile.