exchange
Description:
[ Version ( since = "2.74" ) ]
[ CCode ( cname = "g_atomic_int_exchange" ) ]
public uint exchange (ref uint atomic, uint newval)
[ CCode ( cname = "g_atomic_int_exchange" ) ]
public uint exchange (ref uint atomic, uint newval)
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.
Parameters:
atomic | |
newval |
the value to replace with |
Returns:
the value of |
Namespace: GLib.AtomicUint
Package: glib-2.0