|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
线程类 更多...
#include <thread.hpp>
类 | |
| struct | id |
| 线程唯一标识符类 更多... | |
Public 类型 | |
| using | native_handle_type |
| 系统线程句柄类型 | |
Public 成员函数 | |
| thread () noexcept=default | |
| 默认构造函数 | |
| template<typename F, typename... Args, typename = enable_if_t<!is_same_v<decay_t<F>, thread>>> | |
| thread (F &&f, Args &&... args) | |
| 从可调用对象构造线程 | |
| thread (const thread &)=delete | |
| thread & | operator= (const thread &)=delete |
| thread (thread &&other) noexcept | |
| 移动构造函数 | |
| thread & | operator= (thread &&other) noexcept |
| 移动赋值运算符 | |
| ~thread () | |
| 析构函数 | |
| MSTL_NODISCARD id | get_id () const noexcept |
| 获取线程标识符 | |
| MSTL_NODISCARD native_handle_type | native_handle () const noexcept |
| 获取原生句柄 | |
| MSTL_NODISCARD bool | joinable () const noexcept |
| 检查线程是否可被等待 | |
| void | join () |
| 等待线程结束 | |
| void | detach () |
| 分离线程 | |
| void | swap (thread &other) noexcept |
| 交换两个线程对象 | |
线程类
在文件 thread.hpp 第 30 行定义.
|
defaultnoexcept |
默认构造函数
构造一个不表示任何线程的thread对象。
引用了 thread().
被这些函数引用 operator=(), operator=(), swap(), thread(), thread(), thread() , 以及 thread().
|
inlineexplicit |
从可调用对象构造线程
| F | 可调用对象类型 |
| Args | 参数类型 |
| f | 要执行的可调用对象 |
| args | 传递给可调用对象的参数 |
| system_exception | 如果线程创建失败 |
创建一个新线程,并在线程中执行带参数的可调用对象。
在文件 thread.hpp 第 214 行定义.
引用了 _MSTL, apply(), forward(), make_tuple(), move() , 以及 thread().
| thread::~thread | ( | ) |
析构函数
| void thread::detach | ( | ) |
|
inlinenoexcept |
| void thread::join | ( | ) |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |