compare_and_exchange
Description:
[ CCode ( cname = "g_atomic_int_compare_and_exchange" ) ]
public bool compare_and_exchange (ref uint atomic, uint oldval, uint newval)
  public bool compare_and_exchange (ref uint atomic, uint oldval, uint newval)
Compares atomic to oldval and, if equal, sets it to newval.
 If atomic was not equal to oldval then 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 atomic has a `volatile` qualifier, this is a historical artifact and the pointer passed to it should not be `volatile`.
Parameters:
| atomic | |
| oldval | the value to compare with | 
| newval | the value to conditionally replace with | 
Returns:
| true if the exchange took place | 
Namespace: GLib.AtomicUint
  
  Package: glib-2.0