Clears and sets bits in a single word variable atomically.
#include <sys/atomic_op.h>
uint
fetch_and_and ( word_addr, mask)
atomic_p word_addr;
int mask;
uint
fetch_and_or ( word_addr, mask)
atomic_p word_addr;
int mask;
word_addr | Specifies the address of the single word variable whose bits are to be cleared or set. |
mask | Specifies the bit mask which is to be applied to the single word variable. |
The fetch_and_and and fetch_and_or kernel services respectively clear and set bits in one word, according to a bit mask, as a single atomic operation. The fetch_and_and service clears bits in the word which correspond to clear bits in the bit mask, and the fetch_and_or service sets bits in the word which correspond to set bits in the bit mask.
These operations are useful when a variable containing bit flags is shared between several kernel threads, since they ensure that the fetch, update, and store operations used to clear or set a bit in the variable occur atomically (are not interruptible).
The fetch_and_and and fetch_and_or kernel services can be called from either the process or interrupt environment.
The fetch_and_and and fetch_and_or kernel services return the original value of the word.
The fetch_and_add kernel service, compare_and_swap kernel service.
Locking Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts