This group of intrinsic functions allows for interlocked access to longword and quadword memory data with the possibility of infinite retries in the presence of contention for access to the target memory. These functions have the following declarations:
int __ADD_ATOMIC_LONG2( void *, int );
int __AND_ATOMIC_LONG2( void *, int );
int __OR_ATOMIC_LONG2( void *, int );
__int64 __ADD_ATOMIC_QUAD2( void *, __int64 );
__int64 __AND_ATOMIC_QUAD2( void *, __int64 );
__int64 __OR_ATOMIC_QUAD2( void *, __int64 );
The first argument to these intrinsics is a pointer to the memory data item to be updated in an interlocked fashion. Note that this pointer must be naturally aligned for the type of access desired (longword or quadword).
The second argument to these intrinsics is an int or _ _int64 value, used in the interlocked ADD, AND, or OR operation.
The return value from these intrinsics is the contents of the memory location specified by the first argument before the ADD, AND, or OR operation is performed.
In the presence of contention with another thread to interlock the target memory location, these intrinsics will spinlock in a compute-intensive fashion in an attempt to acquire the memory interlock.
These intrinsics do not contain memory barrier instructions; developers must add them as required.