VideoPortInterlockedExchange function (video.h)

The VideoPortInterlockedExchange function locks or unlocks a block of memory by setting a user-defined lock variable to TRUE or FALSE, respectively. It returns the previously-held value of the lock variable.

Syntax

VIDEOPORT_API LONG VideoPortInterlockedExchange(
  [in, out] IN OUT PLONG Target,
  [in]      IN LONG      Value
);

Parameters

[in, out] Target

Pointer to a user-defined lock variable that is used to control access to a memory buffer.

[in] Value

Specifies the value to be stored in Target, which indicates whether the memory buffer is to be locked or unlocked. Use TRUE to lock the memory buffer, and FALSE to unlock the memory buffer.

Return value

VideoPortInterlockedExchange returns the value that Target had prior to the function call.

Remarks

VideoPortInterlockedExchange can be used to prevent DMA common-buffer contention in multiple-processor systems.

When the buffer is not being read from or written to, the lock variable should have a value of FALSE. A subsequent call to VideoPortInterlockedExchange with its Target parameter set to TRUE resets the lock variable to TRUE, after which this function returns FALSE. The buffer is now locked, preventing access by other threads. When the current operations on the buffer are complete, unlock the buffer with a call to VideoPortInterlockedExchange with its Target parameter set to FALSE.

Requirements

Requirement Value
Minimum supported client Available in Windows 2000 and later versions of the Windows operating systems.
Target Platform Desktop
Header video.h (include Video.h)
Library Videoprt.lib
DLL Videoprt.sys
IRQL Any level

See also

VideoPortGetCommonBuffer

VideoPortInterlockedDecrement

VideoPortInterlockedIncrement