__fetch_and_or, __fetch_and_orlp

Purpose

Sets bits in the word or doubleword specified by addr by OR-ing that value with the value specified val, in a single atomic operation, and returns the original value of addr.

Prototype

unsigned int __fetch_and_or (volatile unsigned int* addr, unsigned int val);

unsigned long __fetch_and_orlp (volatile unsigned long* addr, unsigned long val);

Parameters

addr
The address of the variable to be ORed. Must be aligned on a 4-byte boundary for a single word and on an 8-byte boundary for a doubleword.
value
The value by which the value in addr is to be ORed.

Usage

This operation is useful when a variable containing bit flags is shared between several threads or processes.

__fetch_and_orlp is valid only in 64-bit mode.