Skip to content

Instantly share code, notes, and snippets.

@RklAlx
Created September 27, 2013 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RklAlx/6727688 to your computer and use it in GitHub Desktop.
Save RklAlx/6727688 to your computer and use it in GitHub Desktop.
InterlockedCompare
/*
Syntax:
LONG __cdecl InterlockedCompareExchange(__inout LONG volatile *Destination,
__in LONG Exchange,
__in LONG Comparand
);
Returns the initial value of 'Destination'.
Note:
To operate on 64-bit values, use the InterlockedCompareExchange64 function.
*/
LONG curr_value;
LONG new_value;
LONG seed;
cur_value = InterlockedCompareExchange(&seed, new_value, old_value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment