tmp/tmpzor02ydq/{from.md → to.md}
RENAMED
|
@@ -1,27 +1,33 @@
|
|
| 1 |
### Shared state <a id="futures.state">[[futures.state]]</a>
|
| 2 |
|
| 3 |
-
Many of the classes introduced in this
|
| 4 |
communicate results. This *shared state* consists of some state
|
| 5 |
information and some (possibly not yet evaluated) *result*, which can be
|
| 6 |
-
a (possibly void) value or an exception.
|
| 7 |
-
defined in this clause reference such shared state.
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
An *asynchronous return object* is an object that reads results from a
|
| 13 |
shared state. A *waiting function* of an asynchronous return object is
|
| 14 |
one that potentially blocks to wait for the shared state to be made
|
| 15 |
ready. If a waiting function can return before the state is made ready
|
| 16 |
because of a timeout ([[thread.req.lockable]]), then it is a *timed
|
| 17 |
waiting function*, otherwise it is a *non-timed waiting function*.
|
| 18 |
|
| 19 |
An *asynchronous provider* is an object that provides a result to a
|
| 20 |
shared state. The result of a shared state is set by respective
|
| 21 |
-
functions on the asynchronous provider.
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
description of those classes and functions that create such a state
|
| 24 |
object.
|
| 25 |
|
| 26 |
When an asynchronous return object or an asynchronous provider is said
|
| 27 |
to release its shared state, it means:
|
|
@@ -68,12 +74,14 @@ the shared state ready until the calling thread exits. The destruction
|
|
| 68 |
of each of that thread’s objects with thread storage duration (
|
| 69 |
[[basic.stc.thread]]) is sequenced before making that shared state
|
| 70 |
ready.
|
| 71 |
|
| 72 |
Access to the result of the same shared state may conflict (
|
| 73 |
-
[[intro.multithread]]).
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
| 79 |
|
|
|
|
| 1 |
### Shared state <a id="futures.state">[[futures.state]]</a>
|
| 2 |
|
| 3 |
+
Many of the classes introduced in this subclause use some state to
|
| 4 |
communicate results. This *shared state* consists of some state
|
| 5 |
information and some (possibly not yet evaluated) *result*, which can be
|
| 6 |
+
a (possibly void) value or an exception.
|
|
|
|
| 7 |
|
| 8 |
+
[*Note 1*: Futures, promises, and tasks defined in this clause
|
| 9 |
+
reference such shared state. — *end note*]
|
| 10 |
+
|
| 11 |
+
[*Note 2*: The result can be any kind of object including a function to
|
| 12 |
+
compute that result, as used by `async` when `policy` is
|
| 13 |
+
`launch::deferred`. — *end note*]
|
| 14 |
|
| 15 |
An *asynchronous return object* is an object that reads results from a
|
| 16 |
shared state. A *waiting function* of an asynchronous return object is
|
| 17 |
one that potentially blocks to wait for the shared state to be made
|
| 18 |
ready. If a waiting function can return before the state is made ready
|
| 19 |
because of a timeout ([[thread.req.lockable]]), then it is a *timed
|
| 20 |
waiting function*, otherwise it is a *non-timed waiting function*.
|
| 21 |
|
| 22 |
An *asynchronous provider* is an object that provides a result to a
|
| 23 |
shared state. The result of a shared state is set by respective
|
| 24 |
+
functions on the asynchronous provider.
|
| 25 |
+
|
| 26 |
+
[*Note 3*: Such as promises or tasks. — *end note*]
|
| 27 |
+
|
| 28 |
+
The means of setting the result of a shared state is specified in the
|
| 29 |
description of those classes and functions that create such a state
|
| 30 |
object.
|
| 31 |
|
| 32 |
When an asynchronous return object or an asynchronous provider is said
|
| 33 |
to release its shared state, it means:
|
|
|
|
| 74 |
of each of that thread’s objects with thread storage duration (
|
| 75 |
[[basic.stc.thread]]) is sequenced before making that shared state
|
| 76 |
ready.
|
| 77 |
|
| 78 |
Access to the result of the same shared state may conflict (
|
| 79 |
+
[[intro.multithread]]).
|
| 80 |
+
|
| 81 |
+
[*Note 4*: This explicitly specifies that the result of the shared
|
| 82 |
+
state is visible in the objects that reference this state in the sense
|
| 83 |
+
of data race avoidance ([[res.on.data.races]]). For example, concurrent
|
| 84 |
+
accesses through references returned by `shared_future::get()` (
|
| 85 |
+
[[futures.shared_future]]) must either use read-only operations or
|
| 86 |
+
provide additional synchronization. — *end note*]
|
| 87 |
|