qb_atomic_int_compare_and_exchange3
Compares oldval with the integer pointed to by atomic and if they are equal, atomically exchanges *atomic with newval.
Usage
#include <qb/qbatomic.h>
int32_t qb_atomic_int_compare_and_exchange(
volatile int32_t QB_GNUC_MAY_ALIAS *atomic, /* a pointer to an integer */
int32_t oldval, /* the assumed old value of *atomic */
int32_t newval /* the new value of *atomic*/
);
Params
atomic a pointer to an integer
oldval the assumed old value of *atomic
newval the new value of *atomic
Overview
Also acts as a memory barrier.
Return value
QB_TRUE, if *atomic was equal oldval. QB_FALSE otherwise.
Releases
4 releases since Debian 11 (Bullseye); the text changed 3 times.