__sync_fetch_and_xor

Purpose

This function performs an atomic bitwise exclusive OR operation on the variable __v with the variable that __p points to. The result is stored in the address that is specified by __p.

A full memory barrier is created when this function is invoked.

Prototype

T __sync_fetch_and_xor (T* __p, U __v, ...);

Parameters

__p
The pointer of a variable on which the bitwise exclusive OR operation is to be performed. The value of this variable is to be changed to the result of the operation.
__v
The variable with which the bitwise exclusive OR operation is to be performed.

Return value

The function returns the initial value of the variable that __p points to.