Compartir a través de


InterlockedCompareExchangePointer (Windows CE 5.0)

Send Feedback

This function performs an atomic comparison of the specified parameter values and exchanges the values based on the outcome of the comparison. More than one thread cannot use the same variable simultaneously.

If you are exchanging pointer values, this function supersedes InterlockedCompareExchange.

PVOID InterlockedCompareExchangePointer(PVOID* Destination,PVOIDExChange,PVOIDComperand);

Parameters

  • Destination
    [in/out] Pointer to the pointer to the destination value. The sign is ignored.
  • ExChange
    [in] Exchange value. The sign is ignored.
  • Comperand
    [in] Value to compare to Destination. The sign is ignored.

Return Values

The return value is the initial value of the destination.

Remarks

The interlocked functions provide a simple mechanism for synchronizing access to a variable that is shared by multiple threads. The threads of different processes can use this mechanism, if the variable is in shared memory.

InterlockedCompareExchange performs an atomic comparison of the Destination value with the Comperand value. If the Destination value is equal to the Comperand value, the ExChange value is stored in the address specified by Destination. Otherwise, no operation is performed.

Requirements

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

See Also

InterlockedCompareExchange

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.