_InterlockedExchange Intrinsic

The _InterlockedExchange intrinsic has the following declaration:

long _InterlockedExchange( long *lp, long lnew );

This intrinsic function copies the value of lnew to the semaphore data location pointed to by lp. The function then returns the value of the semaphore before it was altered.