forked from kokkos/kokkos-core-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kokkos#120: atomic_compare_exchange_strong md to rst
- Loading branch information
1 parent
8645e1f
commit 4f85246
Showing
2 changed files
with
40 additions
and
31 deletions.
There are no files selected for viewing
31 changes: 0 additions & 31 deletions
31
docs/source/API/core/atomics/atomic_compare_exchange_strong.md
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
docs/source/API/core/atomics/atomic_compare_exchange_strong.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<class T> | ||
bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); | ||
Description | ||
----------- | ||
|
||
- .. code-block:: cpp | ||
|
||
template<class T> | ||
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. |