From Jason Turner

[depr.util.smartptr.shared.atomic]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmphxjnx_4f/{from.md → to.md} +183 -0
tmp/tmphxjnx_4f/{from.md → to.md} RENAMED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Deprecated `shared_ptr` atomic access <a id="depr.util.smartptr.shared.atomic">[[depr.util.smartptr.shared.atomic]]</a>
2
+
3
+ The header `<memory>` has the following additions:
4
+
5
+ ``` cpp
6
+ namespace std {
7
+ template<class T>
8
+ bool atomic_is_lock_free(const shared_ptr<T>* p);
9
+
10
+ template<class T>
11
+ shared_ptr<T> atomic_load(const shared_ptr<T>* p);
12
+ template<class T>
13
+ shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
14
+
15
+ template<class T>
16
+ void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
17
+ template<class T>
18
+ void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
19
+
20
+ template<class T>
21
+ shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
22
+ template<class T>
23
+ shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
24
+
25
+ template<class T>
26
+ bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
27
+ template<class T>
28
+ bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
29
+ template<class T>
30
+ bool atomic_compare_exchange_weak_explicit(
31
+ shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
32
+ memory_order success, memory_order failure);
33
+ template<class T>
34
+ bool atomic_compare_exchange_strong_explicit(
35
+ shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
36
+ memory_order success, memory_order failure);
37
+ }
38
+ ```
39
+
40
+ Concurrent access to a `shared_ptr` object from multiple threads does
41
+ not introduce a data race if the access is done exclusively via the
42
+ functions in this subclause and the instance is passed as their first
43
+ argument.
44
+
45
+ The meaning of the arguments of type `memory_order` is explained in 
46
+ [[atomics.order]].
47
+
48
+ ``` cpp
49
+ template<class T> bool atomic_is_lock_free(const shared_ptr<T>* p);
50
+ ```
51
+
52
+ *Requires:* `p` shall not be null.
53
+
54
+ *Returns:* `true` if atomic access to `*p` is lock-free, `false`
55
+ otherwise.
56
+
57
+ *Throws:* Nothing.
58
+
59
+ ``` cpp
60
+ template<class T> shared_ptr<T> atomic_load(const shared_ptr<T>* p);
61
+ ```
62
+
63
+ *Requires:* `p` shall not be null.
64
+
65
+ *Returns:* `atomic_load_explicit(p, memory_order::seq_cst)`.
66
+
67
+ *Throws:* Nothing.
68
+
69
+ ``` cpp
70
+ template<class T> shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
71
+ ```
72
+
73
+ *Requires:* `p` shall not be null.
74
+
75
+ *Requires:* `mo` shall not be `memory_order::release` or
76
+ `memory_order::acq_rel`.
77
+
78
+ *Returns:* `*p`.
79
+
80
+ *Throws:* Nothing.
81
+
82
+ ``` cpp
83
+ template<class T> void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
84
+ ```
85
+
86
+ *Requires:* `p` shall not be null.
87
+
88
+ *Effects:* As if by
89
+ `atomic_store_explicit(p, r, memory_order::seq_cst)`.
90
+
91
+ *Throws:* Nothing.
92
+
93
+ ``` cpp
94
+ template<class T> void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
95
+ ```
96
+
97
+ *Requires:* `p` shall not be null.
98
+
99
+ *Requires:* `mo` shall not be `memory_order::acquire` or
100
+ `memory_order::acq_rel`.
101
+
102
+ *Effects:* As if by `p->swap(r)`.
103
+
104
+ *Throws:* Nothing.
105
+
106
+ ``` cpp
107
+ template<class T> shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
108
+ ```
109
+
110
+ *Requires:* `p` shall not be null.
111
+
112
+ *Returns:* `atomic_exchange_explicit(p, r, memory_order::seq_cst)`.
113
+
114
+ *Throws:* Nothing.
115
+
116
+ ``` cpp
117
+ template<class T>
118
+ shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
119
+ ```
120
+
121
+ *Requires:* `p` shall not be null.
122
+
123
+ *Effects:* As if by `p->swap(r)`.
124
+
125
+ *Returns:* The previous value of `*p`.
126
+
127
+ *Throws:* Nothing.
128
+
129
+ ``` cpp
130
+ template<class T>
131
+ bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
132
+ ```
133
+
134
+ *Requires:* `p` shall not be null and `v` shall not be null.
135
+
136
+ *Returns:*
137
+
138
+ ``` cpp
139
+ atomic_compare_exchange_weak_explicit(p, v, w, memory_order::seq_cst, memory_order::seq_cst)
140
+ ```
141
+
142
+ *Throws:* Nothing.
143
+
144
+ ``` cpp
145
+ template<class T>
146
+ bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
147
+ ```
148
+
149
+ *Returns:*
150
+
151
+ ``` cpp
152
+ atomic_compare_exchange_strong_explicit(p, v, w, memory_order::seq_cst,
153
+ memory_order::seq_cst)
154
+ ```
155
+
156
+ ``` cpp
157
+ template<class T>
158
+ bool atomic_compare_exchange_weak_explicit(
159
+ shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
160
+ memory_order success, memory_order failure);
161
+ template<class T>
162
+ bool atomic_compare_exchange_strong_explicit(
163
+ shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
164
+ memory_order success, memory_order failure);
165
+ ```
166
+
167
+ *Requires:* `p` shall not be null and `v` shall not be null. The
168
+ `failure` argument shall not be `memory_order::release` nor
169
+ `memory_order::acq_rel`.
170
+
171
+ *Effects:* If `*p` is equivalent to `*v`, assigns `w` to `*p` and has
172
+ synchronization semantics corresponding to the value of `success`,
173
+ otherwise assigns `*p` to `*v` and has synchronization semantics
174
+ corresponding to the value of `failure`.
175
+
176
+ *Returns:* `true` if `*p` was equivalent to `*v`, `false` otherwise.
177
+
178
+ *Throws:* Nothing.
179
+
180
+ *Remarks:* Two `shared_ptr` objects are equivalent if they store the
181
+ same pointer value and share ownership. The weak form may fail
182
+ spuriously. See  [[atomics.types.operations]].
183
+