Share via


_InterlockedCompareExchange (Windows Embedded CE 6.0)

1/5/2010

This function atomically compares a variable value to a comparison value and exchanges the value of Destination with Exchange if they are the same.

The function prevents more than one thread from using the same variable simultaneously.

Syntax

InterlockedCompareExchange(
  PVOID* Destination,
  PVOID ExChange,
  PVOID Comperand
);

Parameters

  • Destination
    [out] Pointer to the value that the function compares to Comperand.
  • ExChange
    [in] Value used to replace contents of Destination, if necessary.
  • Comperand
    [in] Standard value used for comparison to the value in Destination.

Return Values

Initial value of the variable pointed to by 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.

Requirements

Architecture MIPS 32, MIPS IV, MIPS16, MIPSII, MIPSIII
Header winnt.h
Routine _InterlockedCompareExchange

See Also

Reference

Intrinsic Functions for MIPS Microprocessors