Clears and sets bits in a variable atomically.
Item | Description |
---|---|
addr | Specifies the address of the variable whose bits are to be cleared or set. |
mask | Specifies the bit mask which is to be applied to the variable. |
The fetch_and_and and fetch_and_or kernel services respectively clear and set bits in a variable, according to a bit mask, as a single atomic operation. The fetch_and_and service clears bits in the variable which correspond to clear bits in the bit mask, and the fetch_and_or service sets bits in the variable which correspond to set bits in the bit mask.
The fetch_and_add and fetch_and_or kernel services operate on a single word (32 bit) variable while the fetch_and_addlp and fetch_and_orlp kernel services operate on a double word (64 bit) variable.
These operations are useful when a variable containing bit flags is shared between several kernel threads, because 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 variable.