From Jason Turner

[stopcallback.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpsihakfnh/{from.md → to.md} +18 -34
tmp/tmpsihakfnh/{from.md → to.md} RENAMED
@@ -1,45 +1,29 @@
1
  #### Constructors and destructor <a id="stopcallback.cons">[[stopcallback.cons]]</a>
2
 
3
  ``` cpp
4
- template<class C>
5
- explicit stop_callback(const stop_token& st, C&& cb)
6
- noexcept(is_nothrow_constructible_v<Callback, C>);
7
- template<class C>
8
- explicit stop_callback(stop_token&& st, C&& cb)
9
- noexcept(is_nothrow_constructible_v<Callback, C>);
 
10
  ```
11
 
12
- *Constraints:* `Callback` and `C` satisfy
13
- `constructible_from<Callback, C>`.
14
-
15
- *Preconditions:* `Callback` and `C` model
16
- `constructible_from<Callback, C>`.
17
-
18
- *Effects:* Initializes `callback` with `std::forward<C>(cb)`. If
19
- `st.stop_requested()` is `true`, then
20
- `std::forward<Callback>(callback)()` is evaluated in the current thread
21
- before the constructor returns. Otherwise, if `st` has ownership of a
22
- stop state, acquires shared ownership of that stop state and registers
23
- the callback with that stop state such that
24
- `std::forward<Callback>(callback)()` is evaluated by the first call to
25
- `request_stop()` on an associated `stop_source`.
26
-
27
- *Throws:* Any exception thrown by the initialization of `callback`.
28
-
29
- *Remarks:* If evaluating `std::forward<Callback>(callback)()` exits via
30
- an exception, then `terminate` is invoked [[except.terminate]].
31
 
32
  ``` cpp
33
  ~stop_callback();
34
  ```
35
 
36
- *Effects:* Unregisters the callback from the owned stop state, if any.
37
- The destructor does not block waiting for the execution of another
38
- callback registered by an associated `stop_callback`. If `callback` is
39
- concurrently executing on another thread, then the return from the
40
- invocation of `callback` strongly happens before [[intro.races]]
41
- `callback` is destroyed. If `callback` is executing on the current
42
- thread, then the destructor does not block [[defns.block]] waiting for
43
- the return from the invocation of `callback`. Releases ownership of the
44
- stop state, if any.
45
 
 
1
  #### Constructors and destructor <a id="stopcallback.cons">[[stopcallback.cons]]</a>
2
 
3
  ``` cpp
4
+ template<class Initializer>
5
+ explicit stop_callback(const stop_token& st, Initializer&& init)
6
+ noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);
7
+
8
+ template<class Initializer>
9
+ explicit stop_callback(stop_token&& st, Initializer&& init)
10
+ noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);
11
  ```
12
 
13
+ *Constraints:* `CallbackFn` and `Initializer` satisfy
14
+ `constructible_from<CallbackFn, Initializer>`.
15
+
16
+ *Effects:* Initializes *callback-fn* with
17
+ `std::forward<Initializer>(init)` and executes a stoppable callback
18
+ registration [[stoptoken.concepts]]. If a callback is registered with
19
+ `st`’s shared stop state, then `*this` acquires shared ownership of that
20
+ stop state.
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  ``` cpp
23
  ~stop_callback();
24
  ```
25
 
26
+ *Effects:* Executes a stoppable callback
27
+ deregistration [[stoptoken.concepts]] and releases ownership of the stop
28
+ state, if any.
 
 
 
 
 
 
29