Share via


atomic_compare_exchange Function

Atomically compares the value stored at a memory ___location specified in the first argument for equality with the value of the second specified argument, and if the values are the same, the value at the memory ___location is changed to that of the third specified argument.

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
    The ___location from which one of the values to be compared is read, and to which the new value, if any, is to be stored.

  • _Expected_value
    The ___location from which the second value to be compared is read.

  • _Value
    The value to be stored to the memory ___location specified in by _Dest if _Dest is equal to _Expected_value.

Return Value

true if the operation is successful; otherwise, false.

Requirements

Header: amp.h

Namespace: Concurrency

See Also

Reference

Concurrency Namespace (C++ AMP)