From Jason Turner

[stoptoken]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwtevmnek/{from.md → to.md} +127 -0
tmp/tmpwtevmnek/{from.md → to.md} RENAMED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class `stop_token` <a id="stoptoken">[[stoptoken]]</a>
2
+
3
+ The class `stop_token` provides an interface for querying whether a stop
4
+ request has been made (`stop_requested`) or can ever be made
5
+ (`stop_possible`) using an associated `stop_source` object (
6
+ [[stopsource]]). A `stop_token` can also be passed to a `stop_callback`
7
+ [[stopcallback]] constructor to register a callback to be called when a
8
+ stop request has been made from an associated `stop_source`.
9
+
10
+ ``` cpp
11
+ namespace std {
12
+ class stop_token {
13
+ public:
14
+ // [stoptoken.cons], constructors, copy, and assignment
15
+ stop_token() noexcept;
16
+
17
+ stop_token(const stop_token&) noexcept;
18
+ stop_token(stop_token&&) noexcept;
19
+ stop_token& operator=(const stop_token&) noexcept;
20
+ stop_token& operator=(stop_token&&) noexcept;
21
+ ~stop_token();
22
+ void swap(stop_token&) noexcept;
23
+
24
+ // [stoptoken.mem], stop handling
25
+ [[nodiscard]] bool stop_requested() const noexcept;
26
+ [[nodiscard]] bool stop_possible() const noexcept;
27
+
28
+ [[nodiscard]] friend bool operator==(const stop_token& lhs, const stop_token& rhs) noexcept;
29
+ friend void swap(stop_token& lhs, stop_token& rhs) noexcept;
30
+ };
31
+ }
32
+ ```
33
+
34
+ #### Constructors, copy, and assignment <a id="stoptoken.cons">[[stoptoken.cons]]</a>
35
+
36
+ ``` cpp
37
+ stop_token() noexcept;
38
+ ```
39
+
40
+ *Ensures:* `stop_possible()` is `false` and `stop_requested()` is
41
+ `false`.
42
+
43
+ [*Note 1*: Because the created `stop_token` object can never receive a
44
+ stop request, no resources are allocated for a stop
45
+ state. — *end note*]
46
+
47
+ ``` cpp
48
+ stop_token(const stop_token& rhs) noexcept;
49
+ ```
50
+
51
+ *Ensures:* `*this == rhs` is `true`.
52
+
53
+ [*Note 2*: `*this` and `rhs` share the ownership of the same stop
54
+ state, if any. — *end note*]
55
+
56
+ ``` cpp
57
+ stop_token(stop_token&& rhs) noexcept;
58
+ ```
59
+
60
+ *Ensures:* `*this` contains the value of `rhs` prior to the start of
61
+ construction and `rhs.stop_possible()` is `false`.
62
+
63
+ ``` cpp
64
+ ~stop_token();
65
+ ```
66
+
67
+ *Effects:* Releases ownership of the stop state, if any.
68
+
69
+ ``` cpp
70
+ stop_token& operator=(const stop_token& rhs) noexcept;
71
+ ```
72
+
73
+ *Effects:* Equivalent to: `stop_token(rhs).swap(*this)`.
74
+
75
+ *Returns:* `*this`.
76
+
77
+ ``` cpp
78
+ stop_token& operator=(stop_token&& rhs) noexcept;
79
+ ```
80
+
81
+ *Effects:* Equivalent to: `stop_token(std::move(rhs)).swap(*this)`.
82
+
83
+ *Returns:* `*this`.
84
+
85
+ ``` cpp
86
+ void swap(stop_token& rhs) noexcept;
87
+ ```
88
+
89
+ *Effects:* Exchanges the values of `*this` and `rhs`.
90
+
91
+ #### Members <a id="stoptoken.mem">[[stoptoken.mem]]</a>
92
+
93
+ ``` cpp
94
+ [[nodiscard]] bool stop_requested() const noexcept;
95
+ ```
96
+
97
+ *Returns:* `true` if `*this` has ownership of a stop state that has
98
+ received a stop request; otherwise, `false`.
99
+
100
+ ``` cpp
101
+ [[nodiscard]] bool stop_possible() const noexcept;
102
+ ```
103
+
104
+ *Returns:* `false` if:
105
+
106
+ - `*this` does not have ownership of a stop state, or
107
+ - a stop request was not made and there are no associated `stop_source`
108
+ objects;
109
+
110
+ otherwise, `true`.
111
+
112
+ #### Non-member functions <a id="stoptoken.nonmembers">[[stoptoken.nonmembers]]</a>
113
+
114
+ ``` cpp
115
+ [[nodiscard]] bool operator==(const stop_token& lhs, const stop_token& rhs) noexcept;
116
+ ```
117
+
118
+ *Returns:* `true` if `lhs` and `rhs` have ownership of the same stop
119
+ state or if both `lhs` and `rhs` do not have ownership of a stop state;
120
+ otherwise `false`.
121
+
122
+ ``` cpp
123
+ friend void swap(stop_token& x, stop_token& y) noexcept;
124
+ ```
125
+
126
+ *Effects:* Equivalent to: `x.swap(y)`.
127
+