ATOMIC_SETBITS_INT(9) Kernel Developer's Manual ATOMIC_SETBITS_INT(9)

atomic_setbits_int, atomic_clearbits_intinterface to perform atomic operations on data

#include <sys/atomic.h>

void
atomic_setbits_int(unsigned int *p, unsigned int b);

void
atomic_clearbits_int(unsigned int *p, unsigned int b);

The atomic bits set of functions provide an interface for changing data atomically with respect to interrupts and multiple processors in the system.

The () function sets the bits in b in the integer pointed to by p. It is equivalent to

*p |= b;

The () function clears the bits in b in the integer pointed to by p. It is equivalent to

*p &= ~b;

atomic_setbits_int(), and atomic_clearbits_int() can be called during autoconf, from process context, or from interrupt context.

atomic_add_int(9), atomic_cas_uint(9), atomic_dec_int(9), atomic_inc_int(9), atomic_sub_int(9), atomic_swap_uint(9)

The atomic_setbits_int functions first appeared in OpenBSD 4.1.

February 13, 2014 OpenBSD 7.5