qb_atomic_pointer_compare_and_exchange3
Compares oldval with the pointer pointed to by atomic and if they are equal, atomically exchanges *atomic with newval.
Usage
#include <qb/qbatomic.h>
int32_t qb_atomic_pointer_compare_and_exchange(
volatile void *QB_GNUC_MAY_ALIAS *atomic, /* a pointer to a void* */
void *oldval, /* the assumed old value of *atomic */
void *newval /* the new value of *atomic*/
);
Params
atomic a pointer to a void*
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, else QB_FALSE.
Releases
4 releases since Debian 11 (Bullseye); the text changed 3 times.