Function

GLib-2.0GLibatomic_pointer_exchangeSince 2.74

  • 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

    • Optionalatomic: any

      a pointer to a gpointer-sized value

    • Optionalnewval: any

      the value to replace with

    Returns any

    the value of atomic before the exchange

    2.74