tmp/tmplt3l1w6i/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Members <a id="thread.jthread.mem">[[thread.jthread.mem]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
void swap(jthread& x) noexcept;
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
*Effects:* Exchanges the values of `*this` and `x`.
|
| 8 |
+
|
| 9 |
+
``` cpp
|
| 10 |
+
[[nodiscard]] bool joinable() const noexcept;
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
*Returns:* `get_id() != id()`.
|
| 14 |
+
|
| 15 |
+
``` cpp
|
| 16 |
+
void join();
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
*Effects:* Blocks until the thread represented by `*this` has completed.
|
| 20 |
+
|
| 21 |
+
*Synchronization:* The completion of the thread represented by `*this`
|
| 22 |
+
synchronizes with [[intro.multithread]] the corresponding successful
|
| 23 |
+
`join()` return.
|
| 24 |
+
|
| 25 |
+
[*Note 1*: Operations on `*this` are not synchronized. — *end note*]
|
| 26 |
+
|
| 27 |
+
*Ensures:* The thread represented by `*this` has completed.
|
| 28 |
+
`get_id() == id()`.
|
| 29 |
+
|
| 30 |
+
*Throws:* `system_error` when an exception is
|
| 31 |
+
required [[thread.req.exception]].
|
| 32 |
+
|
| 33 |
+
*Error conditions:*
|
| 34 |
+
|
| 35 |
+
- `resource_deadlock_would_occur` — if deadlock is detected or
|
| 36 |
+
`get_id() == this_thread::get_id()`.
|
| 37 |
+
- `no_such_process` — if the thread is not valid.
|
| 38 |
+
- `invalid_argument` — if the thread is not joinable.
|
| 39 |
+
|
| 40 |
+
``` cpp
|
| 41 |
+
void detach();
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
*Effects:* The thread represented by `*this` continues execution without
|
| 45 |
+
the calling thread blocking. When `detach()` returns, `*this` no longer
|
| 46 |
+
represents the possibly continuing thread of execution. When the thread
|
| 47 |
+
previously represented by `*this` ends execution, the implementation
|
| 48 |
+
releases any owned resources.
|
| 49 |
+
|
| 50 |
+
*Ensures:* `get_id() == id()`.
|
| 51 |
+
|
| 52 |
+
*Throws:* `system_error` when an exception is
|
| 53 |
+
required [[thread.req.exception]].
|
| 54 |
+
|
| 55 |
+
*Error conditions:*
|
| 56 |
+
|
| 57 |
+
- `no_such_process` — if the thread is not valid.
|
| 58 |
+
- `invalid_argument` — if the thread is not joinable.
|
| 59 |
+
|
| 60 |
+
``` cpp
|
| 61 |
+
id get_id() const noexcept;
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
*Returns:* A default constructed `id` object if `*this` does not
|
| 65 |
+
represent a thread, otherwise `this_thread::get_id()` for the thread of
|
| 66 |
+
execution represented by `*this`.
|
| 67 |
+
|