From Jason Turner

[atomics.ref.ops]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0meaitba/{from.md → to.md} +42 -23
tmp/tmp0meaitba/{from.md → to.md} RENAMED
@@ -28,94 +28,103 @@ bool is_lock_free() const noexcept;
28
 
29
  *Returns:* `true` if operations on all objects of the type
30
  `atomic_ref<T>` are lock-free, `false` otherwise.
31
 
32
  ``` cpp
33
- atomic_ref(T& obj);
34
  ```
35
 
36
  *Preconditions:* The referenced object is aligned to
37
  `required_alignment`.
38
 
39
  *Ensures:* `*this` references `obj`.
40
 
41
  *Throws:* Nothing.
42
 
43
  ``` cpp
44
- atomic_ref(const atomic_ref& ref) noexcept;
45
  ```
46
 
47
  *Ensures:* `*this` references the object referenced by `ref`.
48
 
49
  ``` cpp
50
- void store(T desired, memory_order order = memory_order::seq_cst) const noexcept;
 
51
  ```
52
 
53
- *Preconditions:* The `order` argument is neither
54
- `memory_order::consume`, `memory_order::acquire`, nor
55
- `memory_order::acq_rel`.
 
56
 
57
  *Effects:* Atomically replaces the value referenced by `*ptr` with the
58
  value of `desired`. Memory is affected according to the value of
59
  `order`.
60
 
61
  ``` cpp
62
- T operator=(T desired) const noexcept;
63
  ```
64
 
 
 
65
  *Effects:* Equivalent to:
66
 
67
  ``` cpp
68
  store(desired);
69
  return desired;
70
  ```
71
 
72
  ``` cpp
73
- T load(memory_order order = memory_order::seq_cst) const noexcept;
74
  ```
75
 
76
- *Preconditions:* The `order` argument is neither `memory_order::release`
77
- nor `memory_order::acq_rel`.
78
 
79
  *Effects:* Memory is affected according to the value of `order`.
80
 
81
  *Returns:* Atomically returns the value referenced by `*ptr`.
82
 
83
  ``` cpp
84
- operator T() const noexcept;
85
  ```
86
 
87
  *Effects:* Equivalent to: `return load();`
88
 
89
  ``` cpp
90
- T exchange(T desired, memory_order order = memory_order::seq_cst) const noexcept;
 
91
  ```
92
 
 
 
93
  *Effects:* Atomically replaces the value referenced by `*ptr` with
94
  `desired`. Memory is affected according to the value of `order`. This
95
  operation is an atomic read-modify-write
96
  operation [[intro.multithread]].
97
 
98
  *Returns:* Atomically returns the value referenced by `*ptr` immediately
99
  before the effects.
100
 
101
  ``` cpp
102
- bool compare_exchange_weak(T& expected, T desired,
103
  memory_order success, memory_order failure) const noexcept;
104
 
105
- bool compare_exchange_strong(T& expected, T desired,
106
  memory_order success, memory_order failure) const noexcept;
107
 
108
- bool compare_exchange_weak(T& expected, T desired,
109
  memory_order order = memory_order::seq_cst) const noexcept;
110
 
111
- bool compare_exchange_strong(T& expected, T desired,
112
  memory_order order = memory_order::seq_cst) const noexcept;
113
  ```
114
 
115
- *Preconditions:* The `failure` argument is neither
116
- `memory_order::release` nor `memory_order::acq_rel`.
 
 
117
 
118
  *Effects:* Retrieves the value in `expected`. It then atomically
119
  compares the value representation of the value referenced by `*ptr` for
120
  equality with that previously retrieved from `expected`, and if `true`,
121
  replaces the value referenced by `*ptr` with that in `desired`. If and
@@ -149,15 +158,15 @@ compare-and-exchange is in a loop, the weak version will yield better
149
  performance on some platforms. When a weak compare-and-exchange would
150
  require a loop and a strong one would not, the strong one is
151
  preferable. — *end note*]
152
 
153
  ``` cpp
154
- void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
155
  ```
156
 
157
- *Preconditions:* `order` is neither `memory_order::release` nor
158
- `memory_order::acq_rel`.
159
 
160
  *Effects:* Repeatedly performs the following steps, in order:
161
 
162
  - Evaluates `load(order)` and compares its value representation for
163
  equality against that of `old`.
@@ -167,25 +176,35 @@ void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
167
 
168
  *Remarks:* This function is an atomic waiting operation [[atomics.wait]]
169
  on atomic object `*ptr`.
170
 
171
  ``` cpp
172
- void notify_one() const noexcept;
173
  ```
174
 
 
 
175
  *Effects:* Unblocks the execution of at least one atomic waiting
176
  operation on `*ptr` that is eligible to be unblocked [[atomics.wait]] by
177
  this call, if any such atomic waiting operations exist.
178
 
179
  *Remarks:* This function is an atomic notifying
180
  operation [[atomics.wait]] on atomic object `*ptr`.
181
 
182
  ``` cpp
183
- void notify_all() const noexcept;
184
  ```
185
 
 
 
186
  *Effects:* Unblocks the execution of all atomic waiting operations on
187
  `*ptr` that are eligible to be unblocked [[atomics.wait]] by this call.
188
 
189
  *Remarks:* This function is an atomic notifying
190
  operation [[atomics.wait]] on atomic object `*ptr`.
191
 
 
 
 
 
 
 
 
28
 
29
  *Returns:* `true` if operations on all objects of the type
30
  `atomic_ref<T>` are lock-free, `false` otherwise.
31
 
32
  ``` cpp
33
+ constexpr atomic_ref(T& obj);
34
  ```
35
 
36
  *Preconditions:* The referenced object is aligned to
37
  `required_alignment`.
38
 
39
  *Ensures:* `*this` references `obj`.
40
 
41
  *Throws:* Nothing.
42
 
43
  ``` cpp
44
+ constexpr atomic_ref(const atomic_ref& ref) noexcept;
45
  ```
46
 
47
  *Ensures:* `*this` references the object referenced by `ref`.
48
 
49
  ``` cpp
50
+ constexpr void store(value_type desired,
51
+ memory_order order = memory_order::seq_cst) const noexcept;
52
  ```
53
 
54
+ *Constraints:* `is_const_v<T>` is `false`.
55
+
56
+ *Preconditions:* `order` is `memory_order::relaxed`,
57
+ `memory_order::release`, or `memory_order::seq_cst`.
58
 
59
  *Effects:* Atomically replaces the value referenced by `*ptr` with the
60
  value of `desired`. Memory is affected according to the value of
61
  `order`.
62
 
63
  ``` cpp
64
+ constexpr value_type operator=(value_type desired) const noexcept;
65
  ```
66
 
67
+ *Constraints:* `is_const_v<T>` is `false`.
68
+
69
  *Effects:* Equivalent to:
70
 
71
  ``` cpp
72
  store(desired);
73
  return desired;
74
  ```
75
 
76
  ``` cpp
77
+ constexpr value_type load(memory_order order = memory_order::seq_cst) const noexcept;
78
  ```
79
 
80
+ *Preconditions:* `order` is `memory_order::relaxed`,
81
+ `memory_order::acquire`, or `memory_order::seq_cst`.
82
 
83
  *Effects:* Memory is affected according to the value of `order`.
84
 
85
  *Returns:* Atomically returns the value referenced by `*ptr`.
86
 
87
  ``` cpp
88
+ constexpr operator value_type() const noexcept;
89
  ```
90
 
91
  *Effects:* Equivalent to: `return load();`
92
 
93
  ``` cpp
94
+ constexpr value_type exchange(value_type desired,
95
+ memory_order order = memory_order::seq_cst) const noexcept;
96
  ```
97
 
98
+ *Constraints:* `is_const_v<T>` is `false`.
99
+
100
  *Effects:* Atomically replaces the value referenced by `*ptr` with
101
  `desired`. Memory is affected according to the value of `order`. This
102
  operation is an atomic read-modify-write
103
  operation [[intro.multithread]].
104
 
105
  *Returns:* Atomically returns the value referenced by `*ptr` immediately
106
  before the effects.
107
 
108
  ``` cpp
109
+ constexpr bool compare_exchange_weak(value_type& expected, value_type desired,
110
  memory_order success, memory_order failure) const noexcept;
111
 
112
+ constexpr bool compare_exchange_strong(value_type& expected, value_type desired,
113
  memory_order success, memory_order failure) const noexcept;
114
 
115
+ constexpr bool compare_exchange_weak(value_type& expected, value_type desired,
116
  memory_order order = memory_order::seq_cst) const noexcept;
117
 
118
+ constexpr bool compare_exchange_strong(value_type& expected, value_type desired,
119
  memory_order order = memory_order::seq_cst) const noexcept;
120
  ```
121
 
122
+ *Constraints:* `is_const_v<T>` is `false`.
123
+
124
+ *Preconditions:* `failure` is `memory_order::relaxed`,
125
+ `memory_order::acquire`, or `memory_order::seq_cst`.
126
 
127
  *Effects:* Retrieves the value in `expected`. It then atomically
128
  compares the value representation of the value referenced by `*ptr` for
129
  equality with that previously retrieved from `expected`, and if `true`,
130
  replaces the value referenced by `*ptr` with that in `desired`. If and
 
158
  performance on some platforms. When a weak compare-and-exchange would
159
  require a loop and a strong one would not, the strong one is
160
  preferable. — *end note*]
161
 
162
  ``` cpp
163
+ constexpr void wait(value_type old, memory_order order = memory_order::seq_cst) const noexcept;
164
  ```
165
 
166
+ *Preconditions:* `order` is `memory_order::relaxed`,
167
+ `memory_order::acquire`, or `memory_order::seq_cst`.
168
 
169
  *Effects:* Repeatedly performs the following steps, in order:
170
 
171
  - Evaluates `load(order)` and compares its value representation for
172
  equality against that of `old`.
 
176
 
177
  *Remarks:* This function is an atomic waiting operation [[atomics.wait]]
178
  on atomic object `*ptr`.
179
 
180
  ``` cpp
181
+ constexpr void notify_one() const noexcept;
182
  ```
183
 
184
+ *Constraints:* `is_const_v<T>` is `false`.
185
+
186
  *Effects:* Unblocks the execution of at least one atomic waiting
187
  operation on `*ptr` that is eligible to be unblocked [[atomics.wait]] by
188
  this call, if any such atomic waiting operations exist.
189
 
190
  *Remarks:* This function is an atomic notifying
191
  operation [[atomics.wait]] on atomic object `*ptr`.
192
 
193
  ``` cpp
194
+ constexpr void notify_all() const noexcept;
195
  ```
196
 
197
+ *Constraints:* `is_const_v<T>` is `false`.
198
+
199
  *Effects:* Unblocks the execution of all atomic waiting operations on
200
  `*ptr` that are eligible to be unblocked [[atomics.wait]] by this call.
201
 
202
  *Remarks:* This function is an atomic notifying
203
  operation [[atomics.wait]] on atomic object `*ptr`.
204
 
205
+ ``` cpp
206
+ constexpr T* address() const noexcept;
207
+ ```
208
+
209
+ *Returns:* `ptr`.
210
+