Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

InterlockedExchange function

Assigns value to dest and returns the original value.


void InterlockedExchange(
  in  R dest,
  in  T value,
  out T original_value


dest [in]

Type: R

The destination address.

value [in]

Type: T

The input value.

original_value [out]

Type: T

The original value.

Return value

This function does not return a value.


This operation can only be performed on scalar-typed resources and shared memory variables. There are two possible uses for this function. The first is when R is a shared memory variable type. In this case, the function performs the operation on the shared memory register referenced by dest. The second scenario is when R is a resource variable type. In this scenario, the function performs the operation on the resource location referenced by dest. This operation is only available when R is readable and writable.

Minimum Shader Model

This function is supported in the following shader models.

Shader ModelSupported
Shader Model 5 and higher shader modelsyes


This function is supported in the following types of shaders:



See also

Intrinsic Functions
Shader Model 5



© 2017 Microsoft