tmp/tmpmmu2cbsn/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Non-member functions <a id="atomics.nonmembers">[[atomics.nonmembers]]</a>
|
| 2 |
+
|
| 3 |
+
A non-member function template whose name matches the pattern `atomic_f`
|
| 4 |
+
or the pattern `atomic_f_explicit` invokes the member function `f`, with
|
| 5 |
+
the value of the first parameter as the object expression and the values
|
| 6 |
+
of the remaining parameters (if any) as the arguments of the member
|
| 7 |
+
function call, in order. An argument for a parameter of type
|
| 8 |
+
`atomic<T>::value_type*` is dereferenced when passed to the member
|
| 9 |
+
function call. If no such member function exists, the program is
|
| 10 |
+
ill-formed.
|
| 11 |
+
|
| 12 |
+
``` cpp
|
| 13 |
+
template<class T>
|
| 14 |
+
void atomic_init(volatile atomic<T>* object, typename atomic<T>::value_type desired) noexcept;
|
| 15 |
+
template<class T>
|
| 16 |
+
void atomic_init(atomic<T>* object, typename atomic<T>::value_type desired) noexcept;
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
*Effects:* Non-atomically initializes `*object` with value `desired`.
|
| 20 |
+
This function shall only be applied to objects that have been default
|
| 21 |
+
constructed, and then only once.
|
| 22 |
+
|
| 23 |
+
[*Note 1*: These semantics ensure compatibility with C. — *end note*]
|
| 24 |
+
|
| 25 |
+
[*Note 2*: Concurrent access from another thread, even via an atomic
|
| 26 |
+
operation, constitutes a data race. — *end note*]
|
| 27 |
+
|
| 28 |
+
[*Note 1*: The non-member functions enable programmers to write code
|
| 29 |
+
that can be compiled as either C or C++, for example in a shared header
|
| 30 |
+
file. — *end note*]
|
| 31 |
+
|