次の方法で共有


_InterlockedExchange (Windows Embedded CE 6.0)

1/5/2010

This function atomically exchanges a pair of 32-bit values. The function prevents more than one thread from using the same variable simultaneously.

Syntax

LONG InterlockedExchange(
  LONG volatile* Target,
  LONG Value
);

Parameters

  • Target
    [in, out] Pointer to the value to be exchanged. The function sets this variable to Value, and returns its prior value.
  • Value
    [in] Value to be exchanged with the value pointed to by Target.

Return Values

The function returns the initial value of the target.

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.

The variable pointed to by the Target parameter must be aligned on a 32-bit boundary; otherwise, this function will fail on multiprocessor x86 systems and any non-x86 systems.

This function should not be used on memory allocated with the PAGE_NOCACHE modifier.

Requirements

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

See Also

Reference

Intrinsic Functions for MIPS Microprocessors