tmp/tmpywd77wb9/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### [[thread]]: concurrency support library <a id="diff.cpp20.thread">[[diff.cpp20.thread]]</a>
|
| 2 |
+
|
| 3 |
+
**Change:** In this revision of C++, it is implementation-defined
|
| 4 |
+
whether a barrier’s phase completion step runs if no thread calls
|
| 5 |
+
`wait`. Previously the phase completion step was guaranteed to run on
|
| 6 |
+
the last thread that calls `arrive` or `arrive_and_drop` during the
|
| 7 |
+
phase. In this revision of C++, it can run on any of the threads that
|
| 8 |
+
arrived or waited at the barrier during the phase. **Rationale:**
|
| 9 |
+
Correct contradictory wording and improve implementation flexibility for
|
| 10 |
+
performance. **Effect on original feature:** Valid C++20 code using a
|
| 11 |
+
barrier might have different semantics in this revision of C++ if it
|
| 12 |
+
depends on a completion function’s side effects occurring exactly once,
|
| 13 |
+
on a specific thread running the phase completion step, or on a
|
| 14 |
+
completion function’s side effects occurring without `wait` having been
|
| 15 |
+
called. For example:
|
| 16 |
+
|
| 17 |
+
``` cpp
|
| 18 |
+
auto b0 = std::barrier(1);
|
| 19 |
+
b0.arrive();
|
| 20 |
+
b0.arrive(); // implementation-defined; previously well-defined
|
| 21 |
+
|
| 22 |
+
int data = 0;
|
| 23 |
+
auto b1 = std::barrier(1, [&] { data++; });
|
| 24 |
+
b1.arrive();
|
| 25 |
+
assert(data == 1); // implementation-defined; previously well-defined
|
| 26 |
+
b1.arrive(); // implementation-defined; previously well-defined
|
| 27 |
+
```
|
| 28 |
+
|