This group of intrinsic functions allow for interlocked access to longword and quadword memory data with control over the number of retries attempted in the presence of contention for access to the target memory. These functions have the following declarations:
int __ADD_ATOMIC_LONG3( void *, int, int );
int __AND_ATOMIC_LONG3( void *, int, int );
int __OR_ATOMIC_LONG3( void *, int, int );
int __ADD_ATOMIC_QUAD3( void *, __int64, int );
int __AND_ATOMIC_QUAD3( void *, __int64, int );
int __OR_ATOMIC_QUAD3( void *, __int64, int );
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 third argument to these intrinsics specifies the maximum number of attempts used to acquire the interlock to the memory data item involved.
These intrinsics return 1 if the operation completed before the maximum number of retries was exceeded, 0 otherwise.
Note that these intrinsics do not contain memory barrier instructions; you are responsible for adding them as required.