From 4f852466aa4c045cf65f0b0cf10c1efa828998cd Mon Sep 17 00:00:00 2001 From: pierrepebay Date: Mon, 30 Jan 2023 00:29:52 +0100 Subject: [PATCH] kokkos#120: atomic_compare_exchange_strong md to rst --- .../atomics/atomic_compare_exchange_strong.md | 31 -------------- .../atomic_compare_exchange_strong.rst | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+), 31 deletions(-) delete mode 100644 docs/source/API/core/atomics/atomic_compare_exchange_strong.md create mode 100644 docs/source/API/core/atomics/atomic_compare_exchange_strong.rst diff --git a/docs/source/API/core/atomics/atomic_compare_exchange_strong.md b/docs/source/API/core/atomics/atomic_compare_exchange_strong.md deleted file mode 100644 index 57706db9e..000000000 --- a/docs/source/API/core/atomics/atomic_compare_exchange_strong.md +++ /dev/null @@ -1,31 +0,0 @@ -# `atomic_compare_exchange_strong` - -Header File: `Kokkos_Core.hpp` - -Usage: -```c++ -was_exchanged = atomic_compare_exchange_strong(ptr_to_value,comparison_value, new_value); -``` - -Atomically sets the value at the address given by `ptr_to_value` to `new_value` if the current value at `ptr_to_value` -is equal to `comparison_value`, and returns true if the exchange has happened. - -## Synopsis - -```c++ -template -bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); -``` - -## Description - -* ```c++ - template - bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); - ``` - - Atomically executes `old_value = *ptr_to_value; if(old_value==comparison_value) *ptr_to_value = new_value; return old_value==comparison_value;`. - * `ptr_to_value`: address of the to be updated value. - * `comparison_value`: value to be comapred to. - * `new_value`: new value. - * `old_value`: value at address `ptr_to_value` before doing the exchange. diff --git a/docs/source/API/core/atomics/atomic_compare_exchange_strong.rst b/docs/source/API/core/atomics/atomic_compare_exchange_strong.rst new file mode 100644 index 000000000..286a2fd7c --- /dev/null +++ b/docs/source/API/core/atomics/atomic_compare_exchange_strong.rst @@ -0,0 +1,40 @@ +``atomic_compare_exchange_strong`` +================================== + +.. role::cpp(code) + :language: cpp + +Header File: ``Kokkos_Core.hpp`` + +Usage: + +.. code-block:: cpp + + was_exchanged = atomic_compare_exchange_strong(ptr_to_value,comparison_value, new_value); + + +Atomically sets the value at the address given by ``ptr_to_value`` to ``new_value`` if the current value at ``ptr_to_value`` +is equal to ``comparison_value``, and returns true if the exchange has happened. + +Synopsis +-------- + +.. code-block:: cpp + + template + bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); + +Description +----------- + +- .. code-block:: cpp + + template + bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); + + Atomically executes ``old_value = *ptr_to_value; if(old_value==comparison_value) *ptr_to_value = new_value; return old_value==comparison_value;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``comparison_value``: value to be compared to. + - ``new_value``: new value. + - ``old_value``: value at address ``ptr_to_value`` before doing the exchange. \ No newline at end of file