atomic_int64_compare_and_exchange


Description:

[ CCode ( cname = "gpseq_atomic_int64_compare_and_exchange" ) ]
public bool atomic_int64_compare_and_exchange (ref int64 atomic, int64 oldval, int64 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.

Parameters:

atomic

a pointer to a int64 or uint64

oldval

the value to compare with

newval

the value to conditionally replace with

Returns:

%TRUE if the exchange took place


Namespace: Gpseq
Package: gpseq-1.0