_InterlockedCompareExchange Intrinsic

The _InterlockedCompareExchange intrinsic has the following declaration:

void* _InterlockedCompareExchange(void **, void, void);

This intrinsic function performs an interlocked compare of the integer contents of memory specified by the longword-aligned first argument with the value of the third argument. If they are equal, then the value of the second argument is written into the memory location specified by the first argument. The intrinsic returns the previous value of the memory location specified by the first argument. This intrinsic contains required memory barriers.