Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

InterlockedTestExchange (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This function is an interlocked function that performs a conditional setting of a variable.

LONG WINAPI InterlockedTestExchange(
  LPLONG Target, 
  LONG OldValue, 
  LONG NewValue 
);

Parameters

Target
[in] Pointer to the LONG variable to check and set.
OldValue
[in] Value to check against.
NewValue
[in] Value to set to conditionally.

Return Values

The value pointed to by Target at the time of the call — that is, the old value — indicates success.

Remarks

The InterlockedTestExchange function is an interlocked function. In other words, it can be considered atomic. It checks to see if the value pointed to by Target is equal to OldValue. If so, it sets Target to NewValue. Because InterlockedTestExchange returns the old value pointed to by Target, if the return value is OldValue, then InterlockedTestExchange succeeded and set the value pointed to by Target to NewValue. Otherwise, it failed.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show:
© 2015 Microsoft