From Jason Turner

[thread.thread.constr]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0lf131s2/{from.md → to.md} +29 -26
tmp/tmp0lf131s2/{from.md → to.md} RENAMED
@@ -1,47 +1,53 @@
1
- #### `thread` constructors <a id="thread.thread.constr">[[thread.thread.constr]]</a>
2
 
3
  ``` cpp
4
  thread() noexcept;
5
  ```
6
 
7
- *Effects:* Constructs a `thread` object that does not represent a thread
8
- of execution.
9
 
10
- *Postconditions:* `get_id() == id()`.
11
 
12
  ``` cpp
13
  template<class F, class... Args> explicit thread(F&& f, Args&&... args);
14
  ```
15
 
16
- *Requires:*  `F` and each `Ti` in `Args` shall satisfy the
17
- `MoveConstructible` requirements.
18
- ` `*`INVOKE`*`( `*`DECAY_COPY`*`( std::forward<F>(f)), `*`DECAY_COPY`*`( std::forward<Args>(args))...)` ([[func.require]])
19
- shall be a valid expression.
20
-
21
- *Remarks:* This constructor shall not participate in overload resolution
22
- if `decay_t<F>` is the same type as `std::thread`.
23
-
24
- *Effects:*  Constructs an object of type `thread`. The new thread of
25
- execution executes
26
- ` `*`INVOKE`*`( `*`DECAY_COPY`*`( std::forward<F>(f)), `*`DECAY_COPY`*`( std::forward<Args>(args))...)`
27
- with the calls to *`DECAY_COPY`* being evaluated in the constructing
 
 
 
 
 
 
 
 
28
  thread. Any return value from this invocation is ignored.
29
 
30
  [*Note 1*: This implies that any exceptions not thrown from the
31
  invocation of the copy of `f` will be thrown in the constructing thread,
32
  not the new thread. — *end note*]
33
 
34
- If the invocation of
35
- ` `*`INVOKE`*`( `*`DECAY_COPY`*`( std::forward<F>(f)), `*`DECAY_COPY`*`( std::forward<Args>(args))...)`
36
- terminates with an uncaught exception, `terminate` shall be called.
37
 
38
  *Synchronization:* The completion of the invocation of the constructor
39
  synchronizes with the beginning of the invocation of the copy of `f`.
40
 
41
- *Postconditions:* `get_id() != id()`. `*this` represents the newly
42
- started thread.
43
 
44
  *Throws:* `system_error` if unable to start the new thread.
45
 
46
  *Error conditions:*
47
 
@@ -51,11 +57,8 @@ started thread.
51
 
52
  ``` cpp
53
  thread(thread&& x) noexcept;
54
  ```
55
 
56
- *Effects:* Constructs an object of type `thread` from `x`, and sets `x`
57
- to a default constructed state.
58
-
59
- *Postconditions:* `x.get_id() == id()` and `get_id()` returns the value
60
- of `x.get_id()` prior to the start of construction.
61
 
 
1
+ #### Constructors <a id="thread.thread.constr">[[thread.thread.constr]]</a>
2
 
3
  ``` cpp
4
  thread() noexcept;
5
  ```
6
 
7
+ *Effects:* The object does not represent a thread of execution.
 
8
 
9
+ *Ensures:* `get_id() == id()`.
10
 
11
  ``` cpp
12
  template<class F, class... Args> explicit thread(F&& f, Args&&... args);
13
  ```
14
 
15
+ *Constraints:* `remove_cvref_t<F>` is not the same type as `thread`.
16
+
17
+ *Mandates:* The following are all `true`:
18
+
19
+ - `is_constructible_v<decay_t<F>, F>`,
20
+ - `(is_constructible_v<decay_t<Args>, Args> && ...)`,
21
+ - `is_move_constructible_v<decay_t<F>>`,
22
+ - `(is_move_constructible_v<decay_t<Args>> && ...)`, and
23
+ - `is_invocable_v<decay_t<F>, decay_t<Args>...>`.
24
+
25
+ *Preconditions:* `decay_t<F>` and each type in `decay_t<Args>` meet the
26
+ *Cpp17MoveConstructible* requirements.
27
+
28
+ *Effects:* The new thread of execution executes
29
+
30
+ ``` cpp
31
+ invoke(decay-copy(std::forward<F>(f)), decay-copy(std::forward<Args>(args))...)
32
+ ```
33
+
34
+ with the calls to *`decay-copy`* being evaluated in the constructing
35
  thread. Any return value from this invocation is ignored.
36
 
37
  [*Note 1*: This implies that any exceptions not thrown from the
38
  invocation of the copy of `f` will be thrown in the constructing thread,
39
  not the new thread. — *end note*]
40
 
41
+ If the invocation of `invoke` terminates with an uncaught exception,
42
+ `terminate` is called.
 
43
 
44
  *Synchronization:* The completion of the invocation of the constructor
45
  synchronizes with the beginning of the invocation of the copy of `f`.
46
 
47
+ *Ensures:* `get_id() != id()`. `*this` represents the newly started
48
+ thread.
49
 
50
  *Throws:* `system_error` if unable to start the new thread.
51
 
52
  *Error conditions:*
53
 
 
57
 
58
  ``` cpp
59
  thread(thread&& x) noexcept;
60
  ```
61
 
62
+ *Ensures:* `x.get_id() == id()` and `get_id()` returns the value of
63
+ `x.get_id()` prior to the start of construction.
 
 
 
64