Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The InterlockedExchangePointer routine performs an atomic operation that sets a pointer to a new value.
Syntax
PVOID InterlockedExchangePointer(
[in, out] PVOID volatile *Target,
[in, optional] PVOID Value
);
Parameters
[in, out] Target
A pointer to a PVOID value. The routine sets (*Target) to Value.
[in, optional] Value
Specifies the PVOID value to set (*Target) to.
Return value
InterlockedExchangePointer returns the original value of the pointer at *Target (that is, the value of this pointer at entry to the routine).
Remarks
InterlockedExchangePointer provides a fast, atomic way to synchronize updating a pointer variable that is shared by multiple threads.
InterlockedExchangePointer is designed for speed and, typically, is implemented inline by a compiler. InterlockedExchangePointer is atomic only with respect to other InterlockedXxx calls. It does not use a spin lock and can be safely used on pageable data.
The Target parameter should be aligned on either a 32-bit or 64-bit boundary, depending on the system type, for better performance.
A call to InterlockedExchangePointer is atomic only with respect to other InterlockedXxx calls.
Interlocked operations cannot be used on non-cached memory.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Available starting with Windows 2000. |
Target Platform | Desktop |
Header | wdm.h (include Wdm.h, Ntddk.h, Ntifs.h, Miniport.h) |
IRQL | Any level |