From Jason Turner

[thread.jthread.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpo0131kjw/{from.md → to.md} +13 -17
tmp/tmpo0131kjw/{from.md → to.md} RENAMED
@@ -17,34 +17,30 @@ template<class F, class... Args> explicit jthread(F&& f, Args&&... args);
17
  *Constraints:* `remove_cvref_t<F>` is not the same type as `jthread`.
18
 
19
  *Mandates:* The following are all `true`:
20
 
21
  - `is_constructible_v<decay_t<F>, F>`,
22
- - `(is_constructible_v<decay_t<Args>, Args> && ...)`,
23
- - `is_move_constructible_v<decay_t<F>>`,
24
- - `(is_move_constructible_v<decay_t<Args>> && ...)`, and
25
  - `is_invocable_v<decay_t<F>, decay_t<Args>...> ||`
26
  `is_invocable_v<decay_t<F>, stop_token, decay_t<Args>...>`.
27
 
28
- *Preconditions:* `decay_t<F>` and each type in `decay_t<Args>` meet the
29
- *Cpp17MoveConstructible* requirements.
30
-
31
  *Effects:* Initializes `ssource`. The new thread of execution executes
32
 
33
  ``` cpp
34
- invoke(decay-copy(std::forward<F>(f)), get_stop_token(),
35
- decay-copy(std::forward<Args>(args))...)
36
  ```
37
 
38
  if that expression is well-formed, otherwise
39
 
40
  ``` cpp
41
- invoke(decay-copy(std::forward<F>(f)), decay-copy(std::forward<Args>(args))...)
42
  ```
43
 
44
- with the calls to *`decay-copy`* being evaluated in the constructing
45
- thread. Any return value from this invocation is ignored.
 
46
 
47
  [*Note 1*: This implies that any exceptions not thrown from the
48
  invocation of the copy of `f` will be thrown in the constructing thread,
49
  not the new thread. — *end note*]
50
 
@@ -88,16 +84,16 @@ of `x.ssource` prior to the start of construction and
88
 
89
  ``` cpp
90
  jthread& operator=(jthread&& x) noexcept;
91
  ```
92
 
93
- *Effects:* If `joinable()` is `true`, calls `request_stop()` and then
94
- `join()`. Assigns the state of `x` to `*this` and sets `x` to a default
 
95
  constructed state.
96
 
97
- *Ensures:* `x.get_id() == id()` and `get_id()` returns the value of
98
- `x.get_id()` prior to the assignment. `ssource` has the value of
99
- `x.ssource` prior to the assignment and `x.ssource.stop_possible()` is
100
- `false`.
101
 
102
  *Returns:* `*this`.
103
 
 
17
  *Constraints:* `remove_cvref_t<F>` is not the same type as `jthread`.
18
 
19
  *Mandates:* The following are all `true`:
20
 
21
  - `is_constructible_v<decay_t<F>, F>`,
22
+ - `(is_constructible_v<decay_t<Args>, Args> && ...)`, and
 
 
23
  - `is_invocable_v<decay_t<F>, decay_t<Args>...> ||`
24
  `is_invocable_v<decay_t<F>, stop_token, decay_t<Args>...>`.
25
 
 
 
 
26
  *Effects:* Initializes `ssource`. The new thread of execution executes
27
 
28
  ``` cpp
29
+ invoke(auto(std::forward<F>(f)), get_stop_token(), // for invoke, see [func.invoke]
30
+ auto(std::forward<Args>(args))...)
31
  ```
32
 
33
  if that expression is well-formed, otherwise
34
 
35
  ``` cpp
36
+ invoke(auto(std::forward<F>(f)), auto(std::forward<Args>(args))...)
37
  ```
38
 
39
+ with the values produced by `auto` being materialized [[conv.rval]] in
40
+ the constructing thread. Any return value from this invocation is
41
+ ignored.
42
 
43
  [*Note 1*: This implies that any exceptions not thrown from the
44
  invocation of the copy of `f` will be thrown in the constructing thread,
45
  not the new thread. — *end note*]
46
 
 
84
 
85
  ``` cpp
86
  jthread& operator=(jthread&& x) noexcept;
87
  ```
88
 
89
+ *Effects:* If `&x == this` is `true`, there are no effects. Otherwise,
90
+ if `joinable()` is `true`, calls `request_stop()` and then `join()`,
91
+ then assigns the state of `x` to `*this` and sets `x` to a default
92
  constructed state.
93
 
94
+ *Ensures:* `get_id()` returns the value of `x.get_id()` prior to the
95
+ assignment. `ssource` has the value of `x.ssource` prior to the
96
+ assignment.
 
97
 
98
  *Returns:* `*this`.
99