tmp/tmpwhuwi8rz/{from.md → to.md}
RENAMED
|
@@ -3,33 +3,42 @@
|
|
| 3 |
Subclause [[thread.stoptoken]] describes components that can be used to
|
| 4 |
asynchronously request that an operation stops execution in a timely
|
| 5 |
manner, typically because the result is no longer required. Such a
|
| 6 |
request is called a *stop request*.
|
| 7 |
|
| 8 |
-
`
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
- actively poll the token to check if there has been a stop request, or
|
| 18 |
-
- register a callback
|
| 19 |
-
|
| 20 |
|
| 21 |
-
A stop request made via
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
effect).
|
| 25 |
|
| 26 |
-
Callbacks registered via
|
| 27 |
-
request is first made by
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
`
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
|
|
|
| 3 |
Subclause [[thread.stoptoken]] describes components that can be used to
|
| 4 |
asynchronously request that an operation stops execution in a timely
|
| 5 |
manner, typically because the result is no longer required. Such a
|
| 6 |
request is called a *stop request*.
|
| 7 |
|
| 8 |
+
The concepts `stoppable-source`, `stoppable_token`, and
|
| 9 |
+
`stoppable-callback-for` specify the required syntax and semantics of
|
| 10 |
+
shared access to a *stop state*. Any object modeling `stoppable-source`,
|
| 11 |
+
`stoppable_token`, or `stoppable-callback-for` that refers to the same
|
| 12 |
+
stop state is an *associated* `stoppable-source`, `stoppable_token`, or
|
| 13 |
+
`stoppable-callback-for`, respectively.
|
| 14 |
|
| 15 |
+
An object of a type that models `stoppable_token` can be passed to an
|
| 16 |
+
operation that can either
|
| 17 |
|
| 18 |
- actively poll the token to check if there has been a stop request, or
|
| 19 |
+
- register a callback that will be called in the event that a stop
|
| 20 |
+
request is made.
|
| 21 |
|
| 22 |
+
A stop request made via an object whose type models `stoppable-source`
|
| 23 |
+
will be visible to all associated `stoppable_token` and
|
| 24 |
+
`stoppable-source` objects. Once a stop request has been made it cannot
|
| 25 |
+
be withdrawn (a subsequent stop request has no effect).
|
| 26 |
|
| 27 |
+
Callbacks registered via an object whose type models
|
| 28 |
+
`stoppable-callback-for` are called when a stop request is first made by
|
| 29 |
+
any associated `stoppable-source` object.
|
| 30 |
|
| 31 |
+
The types `stop_source` and `stop_token` and the class template
|
| 32 |
+
`stop_callback` implement the semantics of shared ownership of a stop
|
| 33 |
+
state. The last remaining owner of the stop state automatically releases
|
| 34 |
+
the resources associated with the stop state.
|
| 35 |
+
|
| 36 |
+
An object of type `inplace_stop_source` is the sole owner of its stop
|
| 37 |
+
state. An object of type `inplace_stop_token` or of a specialization of
|
| 38 |
+
the class template `inplace_stop_callback` does not participate in
|
| 39 |
+
ownership of its associated stop state.
|
| 40 |
+
|
| 41 |
+
[*Note 1*: They are for use when all uses of the associated token and
|
| 42 |
+
callback objects are known to nest within the lifetime of the
|
| 43 |
+
`inplace_stop_source` object. — *end note*]
|
| 44 |
|