Clears and sets bits in a single word variable atomically.
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).
Note: The word containing the bit flags must be aligned on a full word boundary.
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_and and fetch_and_or kernel services are part of the Base Operating System (BOS) Runtime.
The fetch_and_add kernel service, compare_and_swap kernel service.
Locking Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts