LONG __cdecl InterlockedCompareExchange(
__inout LONG volatile *Destination,
__in LONG Exchange,
__in LONG Comparand
);
Return value
The function returns the initial value of the Destination parameter.
Just curious.
Why does InterlockedCompareExchange return initial value? Is there a reason that they designed so?
Here’s a good example from MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683560%28v=vs.85%29.aspx
Do you see why it’s important to be able to retain the initial value?