tmp/tmphtjx7rye/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="thread.thread.class.general">[[thread.thread.class.general]]</a>
|
| 2 |
+
|
| 3 |
+
The class `thread` provides a mechanism to create a new thread of
|
| 4 |
+
execution, to join with a thread (i.e., wait for a thread to complete),
|
| 5 |
+
and to perform other operations that manage and query the state of a
|
| 6 |
+
thread. A `thread` object uniquely represents a particular thread of
|
| 7 |
+
execution. That representation may be transferred to other `thread`
|
| 8 |
+
objects in such a way that no two `thread` objects simultaneously
|
| 9 |
+
represent the same thread of execution. A thread of execution is
|
| 10 |
+
*detached* when no `thread` object represents that thread. Objects of
|
| 11 |
+
class `thread` can be in a state that does not represent a thread of
|
| 12 |
+
execution.
|
| 13 |
+
|
| 14 |
+
[*Note 1*: A `thread` object does not represent a thread of execution
|
| 15 |
+
after default construction, after being moved from, or after a
|
| 16 |
+
successful call to `detach` or `join`. — *end note*]
|
| 17 |
+
|
| 18 |
+
``` cpp
|
| 19 |
+
namespace std {
|
| 20 |
+
class thread {
|
| 21 |
+
public:
|
| 22 |
+
// [thread.thread.id], class thread::id
|
| 23 |
+
class id;
|
| 24 |
+
using native_handle_type = implementation-defined; // see~[thread.req.native]
|
| 25 |
+
|
| 26 |
+
// construct/copy/destroy
|
| 27 |
+
thread() noexcept;
|
| 28 |
+
template<class F, class... Args> explicit thread(F&& f, Args&&... args);
|
| 29 |
+
~thread();
|
| 30 |
+
thread(const thread&) = delete;
|
| 31 |
+
thread(thread&&) noexcept;
|
| 32 |
+
thread& operator=(const thread&) = delete;
|
| 33 |
+
thread& operator=(thread&&) noexcept;
|
| 34 |
+
|
| 35 |
+
// [thread.thread.member], members
|
| 36 |
+
void swap(thread&) noexcept;
|
| 37 |
+
bool joinable() const noexcept;
|
| 38 |
+
void join();
|
| 39 |
+
void detach();
|
| 40 |
+
id get_id() const noexcept;
|
| 41 |
+
native_handle_type native_handle(); // see~[thread.req.native]
|
| 42 |
+
|
| 43 |
+
// static members
|
| 44 |
+
static unsigned int hardware_concurrency() noexcept;
|
| 45 |
+
};
|
| 46 |
+
}
|
| 47 |
+
```
|
| 48 |
+
|