tmp/tmpzibuubu7/{from.md → to.md}
RENAMED
|
@@ -1,18 +1,12 @@
|
|
| 1 |
-
## Order and consistency <a id="atomics.order">[[atomics.order]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
enum class memory_order : unspecified {
|
| 6 |
relaxed, consume, acquire, release, acq_rel, seq_cst
|
| 7 |
};
|
| 8 |
-
inline constexpr memory_order memory_order_relaxed = memory_order::relaxed;
|
| 9 |
-
inline constexpr memory_order memory_order_consume = memory_order::consume;
|
| 10 |
-
inline constexpr memory_order memory_order_acquire = memory_order::acquire;
|
| 11 |
-
inline constexpr memory_order memory_order_release = memory_order::release;
|
| 12 |
-
inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel;
|
| 13 |
-
inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst;
|
| 14 |
}
|
| 15 |
```
|
| 16 |
|
| 17 |
The enumeration `memory_order` specifies the detailed regular
|
| 18 |
(non-atomic) memory synchronization order as defined in
|
|
@@ -110,14 +104,14 @@ x.store(r1, memory_order::relaxed);
|
|
| 110 |
// Thread 2:
|
| 111 |
r2 = x.load(memory_order::relaxed);
|
| 112 |
y.store(r2, memory_order::relaxed);
|
| 113 |
```
|
| 114 |
|
| 115 |
-
|
| 116 |
-
only possible if the store to `x` stores `42`,
|
| 117 |
-
on the store to `y` storing `42`. Note that
|
| 118 |
-
such an execution is possible.
|
| 119 |
|
| 120 |
— *end note*]
|
| 121 |
|
| 122 |
[*Note 7*:
|
| 123 |
|
|
|
|
| 1 |
+
### Order and consistency <a id="atomics.order">[[atomics.order]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
enum class memory_order : unspecified {
|
| 6 |
relaxed, consume, acquire, release, acq_rel, seq_cst
|
| 7 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
```
|
| 10 |
|
| 11 |
The enumeration `memory_order` specifies the detailed regular
|
| 12 |
(non-atomic) memory synchronization order as defined in
|
|
|
|
| 104 |
// Thread 2:
|
| 105 |
r2 = x.load(memory_order::relaxed);
|
| 106 |
y.store(r2, memory_order::relaxed);
|
| 107 |
```
|
| 108 |
|
| 109 |
+
this recommendation discourages producing `r1 == r2 == 42`, since the
|
| 110 |
+
store of 42 to `y` is only possible if the store to `x` stores `42`,
|
| 111 |
+
which circularly depends on the store to `y` storing `42`. Note that
|
| 112 |
+
without this restriction, such an execution is possible.
|
| 113 |
|
| 114 |
— *end note*]
|
| 115 |
|
| 116 |
[*Note 7*:
|
| 117 |
|