You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example shows a sketch of using a <code>stoppable_token<_Token_></code> to cancel an active operation. The computation in this example is represented as `sleep_for`.
259
271
260
272
```c++
@@ -266,9 +278,11 @@ void compute(std::stoppable_token auto token)
266
278
}
267
279
}
268
280
```
281
+
</div>
269
282
</details>
270
283
<details>
271
284
<summary>Example: inactive</summary>
285
+
<div>
272
286
This example shows how an <code><ahref=‘#operation-state’>operation_state</a></code> can use the <code>callback_type</code> together with a <code>_token_</code> to get notified when cancellation is requested.
The concept <code>unstoppable_token<Token></code> is modeled by a <code>_Token_</code> if <code>stoppable_token<_Token_></code> is true and it can statically be determined that both <code>_token_.stop_requested()</code> and <code>_token_.stop_possible()</code> are `constexpr` epxressions yielding `false`. This concept is primarily used to avoid extra work when using stop tokens which will never indicate that cancellations are requested.
340
+
<div>
341
+
<details>
342
+
<summary>Example</summary>
343
+
The concept yields `true` for the <code><a href=‘#never-stop-token’>std::execution::never_stop_token</a></code>:
0 commit comments