From Jason Turner

[thread.stoptoken.intro]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwhuwi8rz/{from.md → to.md} +30 -21
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
- `stop_source`, `stop_token`, and `stop_callback` implement semantics of
9
- shared ownership of a *stop state*. Any `stop_source`, `stop_token`, or
10
- `stop_callback` that shares ownership of the same stop state is an
11
- *associated* `stop_source`, `stop_token`, or `stop_callback`,
12
- respectively. The last remaining owner of the stop state automatically
13
- releases the resources associated with the stop state.
14
 
15
- A `stop_token` can be passed to an operation which can either
 
16
 
17
  - actively poll the token to check if there has been a stop request, or
18
- - register a callback using the `stop_callback` class template which
19
- will be called in the event that a stop request is made.
20
 
21
- A stop request made via a `stop_source` will be visible to all
22
- associated `stop_token` and `stop_source` objects. Once a stop request
23
- has been made it cannot be withdrawn (a subsequent stop request has no
24
- effect).
25
 
26
- Callbacks registered via a `stop_callback` object are called when a stop
27
- request is first made by any associated `stop_source` object.
 
28
 
29
- Calls to the functions `request_stop`, `stop_requested`, and
30
- `stop_possible` do not introduce data races. A call to `request_stop`
31
- that returns `true` synchronizes with a call to `stop_requested` on an
32
- associated `stop_token` or `stop_source` object that returns `true`.
33
- Registration of a callback synchronizes with the invocation of that
34
- callback.
 
 
 
 
 
 
 
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