Skip to content

Commit eca4fb5

Browse files
authored
Document atomic_assign (#595)
* Fix typo retur[n]s * Document atomic_assign * Fiddle with atomics TOC * Remove old doc for atomic_assign
1 parent 80b9989 commit eca4fb5

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

docs/source/API/core/atomics.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ Atomics
44
.. toctree::
55
:maxdepth: 1
66

7+
./atomics/atomic_load
8+
./atomics/atomic_store
9+
./atomics/atomic_exchange
710
./atomics/atomic_compare_exchange
811
./atomics/atomic_compare_exchange_strong
9-
./atomics/atomic_exchange
12+
./atomics/atomic_assign
1013
./atomics/atomic_fetch_op
11-
./atomics/atomic_load
1214
./atomics/atomic_op
1315
./atomics/atomic_op_fetch
14-
./atomics/atomic_store
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
``atomic_assign``
2+
=================
3+
4+
.. warning::
5+
Deprecated since Kokkos 4.5,
6+
use `atomic_store <atomic_store.html>`_ instead.
7+
8+
.. role:: cppkokkos(code)
9+
:language: cppkokkos
10+
11+
Defined in header ``<Kokkos_Atomic.hpp>`` which is included from ``<Kokkos_Core.hpp>``
12+
13+
Usage
14+
-----
15+
16+
.. code-block:: cpp
17+
18+
atomic_assign(&obj, desired);
19+
// ^^^^^^
20+
// deprecated since Kokkos 4.5,
21+
// use atomic_store(&obj, desired) instead
22+
23+
Atomically replaces the current value of ``obj`` with ``desired``.
24+
25+
Description
26+
-----------
27+
28+
.. cppkokkos:function:: template<class T> void atomic_assign(T* ptr, std::type_identity_t<T> val);
29+
30+
Atomically writes ``val`` into ``*ptr``.
31+
32+
``{ *ptr = val; }``
33+
34+
:param ptr: address of the object whose value is to be replaced
35+
:param val: the value to store in the referenced object
36+
:returns: (nothing)
37+

docs/source/API/core/atomics/atomic_exchange.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Usage
1313
1414
auto old = atomic_exchange(&obj, desired);
1515
16-
Atomically replaces the value of ``obj`` with ``desired`` and returs the value before the call.
16+
Atomically replaces the value of ``obj`` with ``desired`` and returns the value before the call.
1717

1818
Description
1919
-----------

docs/source/API/core/atomics/atomic_op.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ Description
3434

3535
* ``value``: value with which to combine the original value.
3636

37-
.. cppkokkos:function:: template<class T> void atomic_assign(T* const ptr_to_value, const T value);
38-
39-
Atomically executes ``*ptr_to_value = value``.
40-
41-
* ``ptr_to_value``: address of the to be updated value.
42-
43-
* ``value``: new value.
44-
4537
.. cppkokkos:function:: template<class T> void atomic_decrement(T* const ptr_to_value);
4638
4739
Atomically executes ``(*ptr_to_value)--`` or calls ``atomic_fetch_sub(ptr_to_value, T(-1))``.

0 commit comments

Comments
 (0)