__sync_xor_and_fetch

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_xor_and_fetch (T* __p, U __v, ...);

Parameters

__p
The pointer of the 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 new value of the variable that __p points to.