From Jason Turner

[util.smartptr.shared.atomic]

Diff to HTML by rtfpessoa

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