atomic_compare_exchange Function

Atomically compares the value at a memory location for equality with an expected value. If the values are the same, the memory location is replaced with a new value.

inline bool atomic_compare_exchange(
   _Inout_ int * _Dest,
   _Inout_ int * _Expected_value,
   int _Value                     
) restrict(amp);
                     
inline bool atomic_compare_exchange(
   _Inout_ unsigned int * _Dest,
   _Inout_ unsigned int * _Expected_value,
   unsigned int _Value                     
) restrict(amp);

Parameters

  • _Dest
    Pointer to the memory location.

  • _Expected_value
    The value to be compared to the memory location.

  • _Value
    The new value to be set to the memory location.

Return Value

true if the operation is successful; otherwise, false.

Requirements

Header: amp.h

Namespace: Concurrency

See Also

Reference

Concurrency Namespace (C++ AMP)