syclreference.com
  1. SYCL
  2. | API Reference
  3. | Atomics
  4. | atomic
  5. | compare_exchange_strong

compare_exchange_strong

Atomically compare and optionally exchange expected with *m_data. Calls C++11 equivalent on host, has to be implemented “by hand” on device because OpenCL 1.2 and C++ 11 have different semantics for compare and exchange. If *m_data == expected, performs *m_data = desired and returns true. Otherwise, performs expected = *m_data and returns false.


cl::sycl::cl_bool compare_exchange_strong(T & expected, T desired, cl::sycl::memory_order success, cl::sycl::memory_order fail) volatile
(1)
  1. Atomically compare and optionally exchange expected with *m_data. Calls C++11 equivalent on host, has to be implemented "by hand" on device because OpenCL 1.2 and C++ 11 have different semantics for compare and exchange. If *m_data == expected, performs *m_data = desired and returns true. Otherwise, performs expected = *m_data and returns false.
    Parameters:
    • T & expected : The value to compare against *m_data.
    • T desired : The value to store in *m_data on success.
    • cl::sycl::memory_order success : the ordering to use when comparison succeeds. Can only
    • cl::sycl::memory_order fail : the ordering to use when comparison fails. Can only
    Returns: True if comparison succeeds, false if it fails.

syclreference.com — SYCL Reference Pages

Last updated: 2019-01-24 00:24:52 +0000