ATOMIC_CAS_UINT(9) BSD Kernel Developer's Manual ATOMIC_CAS_UINT(9)
atomic_cas_uint, atomic_cas_ulong, atomic_cas_ptr -- atomic compare-and-
atomic_cas_uint(volatile unsigned int *p, unsigned int expected,
unsigned int new);
atomic_cas_ulong(volatile unsigned long *p, unsigned long expected,
unsigned long new);
atomic_cas_ptr(volatile void *p, void *expected, void *new);
The atomic_cas set of functions provide an interface for atomically per-
forming compare-and-swap operations with respect to interrupts and multi-
ple processors in the system.
The value referenced by the pointer p is compared against expected. If
these values are equal then new replaces the value stored at p.
atomic_cas_uint(), atomic_cas_ulong(), and atomic_cas_ptr() can all be
called during autoconf, from process context, or from interrupt context.
These functions return the value at p as it was before the attempt to
The atomic_cas functions first appeared in NetBSD 5.0 and OpenBSD 5.5.
BSD July 18, 2014 BSD