tmp/tmp0lf131s2/{from.md → to.md}
RENAMED
|
@@ -1,47 +1,53 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
thread() noexcept;
|
| 5 |
```
|
| 6 |
|
| 7 |
-
*Effects:*
|
| 8 |
-
of execution.
|
| 9 |
|
| 10 |
-
*
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
|
| 14 |
```
|
| 15 |
|
| 16 |
-
*
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
`
|
| 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 |
-
*
|
| 42 |
-
|
| 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 |
-
*
|
| 57 |
-
to
|
| 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 |
|