From Jason Turner

[atomics.types.operations]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_cdf573r/{from.md → to.md} +25 -26
tmp/tmp_cdf573r/{from.md → to.md} RENAMED
@@ -2,11 +2,11 @@
2
 
3
  ``` cpp
4
  constexpr atomic() noexcept(is_nothrow_default_constructible_v<T>);
5
  ```
6
 
7
- *Mandates:* `is_default_constructible_v<T>` is `true`.
8
 
9
  *Effects:* Initializes the atomic object with the value of `T()`.
10
  Initialization is not an atomic operation [[intro.multithread]].
11
 
12
  ``` cpp
@@ -46,27 +46,26 @@ otherwise.
46
  consistent with the value of `is_always_lock_free` for the same
47
  type. — *end note*]
48
 
49
  ``` cpp
50
  void store(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
51
- void store(T desired, memory_order order = memory_order::seq_cst) noexcept;
52
  ```
53
 
54
  *Constraints:* For the `volatile` overload of this function,
55
  `is_always_lock_free` is `true`.
56
 
57
- *Preconditions:* The `order` argument is neither
58
- `memory_order::consume`, `memory_order::acquire`, nor
59
- `memory_order::acq_rel`.
60
 
61
  *Effects:* Atomically replaces the value pointed to by `this` with the
62
  value of `desired`. Memory is affected according to the value of
63
  `order`.
64
 
65
  ``` cpp
66
  T operator=(T desired) volatile noexcept;
67
- T operator=(T desired) noexcept;
68
  ```
69
 
70
  *Constraints:* For the `volatile` overload of this function,
71
  `is_always_lock_free` is `true`.
72
 
@@ -74,36 +73,36 @@ T operator=(T desired) noexcept;
74
 
75
  *Returns:* `desired`.
76
 
77
  ``` cpp
78
  T load(memory_order order = memory_order::seq_cst) const volatile noexcept;
79
- T load(memory_order order = memory_order::seq_cst) const noexcept;
80
  ```
81
 
82
  *Constraints:* For the `volatile` overload of this function,
83
  `is_always_lock_free` is `true`.
84
 
85
- *Preconditions:* The `order` argument is neither `memory_order::release`
86
- nor `memory_order::acq_rel`.
87
 
88
  *Effects:* Memory is affected according to the value of `order`.
89
 
90
  *Returns:* Atomically returns the value pointed to by `this`.
91
 
92
  ``` cpp
93
  operator T() const volatile noexcept;
94
- operator T() const noexcept;
95
  ```
96
 
97
  *Constraints:* For the `volatile` overload of this function,
98
  `is_always_lock_free` is `true`.
99
 
100
  *Effects:* Equivalent to: `return load();`
101
 
102
  ``` cpp
103
  T exchange(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
104
- T exchange(T desired, memory_order order = memory_order::seq_cst) noexcept;
105
  ```
106
 
107
  *Constraints:* For the `volatile` overload of this function,
108
  `is_always_lock_free` is `true`.
109
 
@@ -116,31 +115,31 @@ operations [[intro.multithread]].
116
  before the effects.
117
 
118
  ``` cpp
119
  bool compare_exchange_weak(T& expected, T desired,
120
  memory_order success, memory_order failure) volatile noexcept;
121
- bool compare_exchange_weak(T& expected, T desired,
122
  memory_order success, memory_order failure) noexcept;
123
  bool compare_exchange_strong(T& expected, T desired,
124
  memory_order success, memory_order failure) volatile noexcept;
125
- bool compare_exchange_strong(T& expected, T desired,
126
  memory_order success, memory_order failure) noexcept;
127
  bool compare_exchange_weak(T& expected, T desired,
128
  memory_order order = memory_order::seq_cst) volatile noexcept;
129
- bool compare_exchange_weak(T& expected, T desired,
130
  memory_order order = memory_order::seq_cst) noexcept;
131
  bool compare_exchange_strong(T& expected, T desired,
132
  memory_order order = memory_order::seq_cst) volatile noexcept;
133
- bool compare_exchange_strong(T& expected, T desired,
134
  memory_order order = memory_order::seq_cst) noexcept;
135
  ```
136
 
137
  *Constraints:* For the `volatile` overload of this function,
138
  `is_always_lock_free` is `true`.
139
 
140
- *Preconditions:* The `failure` argument is neither
141
- `memory_order::release` nor `memory_order::acq_rel`.
142
 
143
  *Effects:* Retrieves the value in `expected`. It then atomically
144
  compares the value representation of the value pointed to by `this` for
145
  equality with that previously retrieved from `expected`, and if true,
146
  replaces the value pointed to by `this` with that in `desired`. If and
@@ -225,14 +224,14 @@ preferable. — *end note*]
225
 
226
  [*Note 6*: Under cases where the `memcpy` and `memcmp` semantics of the
227
  compare-and-exchange operations apply, the comparisons can fail for
228
  values that compare equal with `operator==` if the value representation
229
  has trap bits or alternate representations of the same value. Notably,
230
- on implementations conforming to ISO/IEC/IEEE 60559, floating-point
231
- `-0.0` and `+0.0` will not compare equal with `memcmp` but will compare
232
- equal with `operator==`, and NaNs with the same payload will compare
233
- equal with `memcmp` but will not compare equal with
234
  `operator==`. — *end note*]
235
 
236
  [*Note 7*:
237
 
238
  Because compare-and-exchange acts on an object’s value representation,
@@ -279,15 +278,15 @@ bool party(pony desired) {
279
 
280
  — *end note*]
281
 
282
  ``` cpp
283
  void wait(T old, memory_order order = memory_order::seq_cst) const volatile noexcept;
284
- void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
285
  ```
286
 
287
- *Preconditions:* `order` is neither `memory_order::release` nor
288
- `memory_order::acq_rel`.
289
 
290
  *Effects:* Repeatedly performs the following steps, in order:
291
 
292
  - Evaluates `load(order)` and compares its value representation for
293
  equality against that of `old`.
@@ -298,11 +297,11 @@ void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
298
  *Remarks:* This function is an atomic waiting
299
  operation [[atomics.wait]].
300
 
301
  ``` cpp
302
  void notify_one() volatile noexcept;
303
- void notify_one() noexcept;
304
  ```
305
 
306
  *Effects:* Unblocks the execution of at least one atomic waiting
307
  operation that is eligible to be unblocked [[atomics.wait]] by this
308
  call, if any such atomic waiting operations exist.
@@ -310,11 +309,11 @@ call, if any such atomic waiting operations exist.
310
  *Remarks:* This function is an atomic notifying
311
  operation [[atomics.wait]].
312
 
313
  ``` cpp
314
  void notify_all() volatile noexcept;
315
- void notify_all() noexcept;
316
  ```
317
 
318
  *Effects:* Unblocks the execution of all atomic waiting operations that
319
  are eligible to be unblocked [[atomics.wait]] by this call.
320
 
 
2
 
3
  ``` cpp
4
  constexpr atomic() noexcept(is_nothrow_default_constructible_v<T>);
5
  ```
6
 
7
+ *Constraints:* `is_default_constructible_v<T>` is `true`.
8
 
9
  *Effects:* Initializes the atomic object with the value of `T()`.
10
  Initialization is not an atomic operation [[intro.multithread]].
11
 
12
  ``` cpp
 
46
  consistent with the value of `is_always_lock_free` for the same
47
  type. — *end note*]
48
 
49
  ``` cpp
50
  void store(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
51
+ constexpr void store(T desired, memory_order order = memory_order::seq_cst) noexcept;
52
  ```
53
 
54
  *Constraints:* For the `volatile` overload of this function,
55
  `is_always_lock_free` is `true`.
56
 
57
+ *Preconditions:* `order` is `memory_order::relaxed`,
58
+ `memory_order::release`, or `memory_order::seq_cst`.
 
59
 
60
  *Effects:* Atomically replaces the value pointed to by `this` with the
61
  value of `desired`. Memory is affected according to the value of
62
  `order`.
63
 
64
  ``` cpp
65
  T operator=(T desired) volatile noexcept;
66
+ constexpr T operator=(T desired) noexcept;
67
  ```
68
 
69
  *Constraints:* For the `volatile` overload of this function,
70
  `is_always_lock_free` is `true`.
71
 
 
73
 
74
  *Returns:* `desired`.
75
 
76
  ``` cpp
77
  T load(memory_order order = memory_order::seq_cst) const volatile noexcept;
78
+ constexpr T load(memory_order order = memory_order::seq_cst) const noexcept;
79
  ```
80
 
81
  *Constraints:* For the `volatile` overload of this function,
82
  `is_always_lock_free` is `true`.
83
 
84
+ *Preconditions:* `order` is `memory_order::relaxed`,
85
+ `memory_order::acquire`, or `memory_order::seq_cst`.
86
 
87
  *Effects:* Memory is affected according to the value of `order`.
88
 
89
  *Returns:* Atomically returns the value pointed to by `this`.
90
 
91
  ``` cpp
92
  operator T() const volatile noexcept;
93
+ constexpr operator T() const noexcept;
94
  ```
95
 
96
  *Constraints:* For the `volatile` overload of this function,
97
  `is_always_lock_free` is `true`.
98
 
99
  *Effects:* Equivalent to: `return load();`
100
 
101
  ``` cpp
102
  T exchange(T desired, memory_order order = memory_order::seq_cst) volatile noexcept;
103
+ constexpr T exchange(T desired, memory_order order = memory_order::seq_cst) noexcept;
104
  ```
105
 
106
  *Constraints:* For the `volatile` overload of this function,
107
  `is_always_lock_free` is `true`.
108
 
 
115
  before the effects.
116
 
117
  ``` cpp
118
  bool compare_exchange_weak(T& expected, T desired,
119
  memory_order success, memory_order failure) volatile noexcept;
120
+ constexpr bool compare_exchange_weak(T& expected, T desired,
121
  memory_order success, memory_order failure) noexcept;
122
  bool compare_exchange_strong(T& expected, T desired,
123
  memory_order success, memory_order failure) volatile noexcept;
124
+ constexpr bool compare_exchange_strong(T& expected, T desired,
125
  memory_order success, memory_order failure) noexcept;
126
  bool compare_exchange_weak(T& expected, T desired,
127
  memory_order order = memory_order::seq_cst) volatile noexcept;
128
+ constexpr bool compare_exchange_weak(T& expected, T desired,
129
  memory_order order = memory_order::seq_cst) noexcept;
130
  bool compare_exchange_strong(T& expected, T desired,
131
  memory_order order = memory_order::seq_cst) volatile noexcept;
132
+ constexpr bool compare_exchange_strong(T& expected, T desired,
133
  memory_order order = memory_order::seq_cst) noexcept;
134
  ```
135
 
136
  *Constraints:* For the `volatile` overload of this function,
137
  `is_always_lock_free` is `true`.
138
 
139
+ *Preconditions:* `failure` is `memory_order::relaxed`,
140
+ `memory_order::acquire`, or `memory_order::seq_cst`.
141
 
142
  *Effects:* Retrieves the value in `expected`. It then atomically
143
  compares the value representation of the value pointed to by `this` for
144
  equality with that previously retrieved from `expected`, and if true,
145
  replaces the value pointed to by `this` with that in `desired`. If and
 
224
 
225
  [*Note 6*: Under cases where the `memcpy` and `memcmp` semantics of the
226
  compare-and-exchange operations apply, the comparisons can fail for
227
  values that compare equal with `operator==` if the value representation
228
  has trap bits or alternate representations of the same value. Notably,
229
+ on implementations conforming to ISO/IEC 60559, floating-point `-0.0`
230
+ and `+0.0` will not compare equal with `memcmp` but will compare equal
231
+ with `operator==`, and NaNs with the same payload will compare equal
232
+ with `memcmp` but will not compare equal with
233
  `operator==`. — *end note*]
234
 
235
  [*Note 7*:
236
 
237
  Because compare-and-exchange acts on an object’s value representation,
 
278
 
279
  — *end note*]
280
 
281
  ``` cpp
282
  void wait(T old, memory_order order = memory_order::seq_cst) const volatile noexcept;
283
+ constexpr void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
284
  ```
285
 
286
+ *Preconditions:* `order` is `memory_order::relaxed`,
287
+ `memory_order::acquire`, or `memory_order::seq_cst`.
288
 
289
  *Effects:* Repeatedly performs the following steps, in order:
290
 
291
  - Evaluates `load(order)` and compares its value representation for
292
  equality against that of `old`.
 
297
  *Remarks:* This function is an atomic waiting
298
  operation [[atomics.wait]].
299
 
300
  ``` cpp
301
  void notify_one() volatile noexcept;
302
+ constexpr void notify_one() noexcept;
303
  ```
304
 
305
  *Effects:* Unblocks the execution of at least one atomic waiting
306
  operation that is eligible to be unblocked [[atomics.wait]] by this
307
  call, if any such atomic waiting operations exist.
 
309
  *Remarks:* This function is an atomic notifying
310
  operation [[atomics.wait]].
311
 
312
  ``` cpp
313
  void notify_all() volatile noexcept;
314
+ constexpr void notify_all() noexcept;
315
  ```
316
 
317
  *Effects:* Unblocks the execution of all atomic waiting operations that
318
  are eligible to be unblocked [[atomics.wait]] by this call.
319