|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
线程类 更多...
#include <thread.hpp>
类 | |
| struct | id |
| 线程唯一标识符类 更多... | |
| struct | hook |
| 线程生命周期钩子 更多... | |
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 (thread &&other) noexcept | |
| 移动构造函数 | |
| thread & | operator= (thread &&other) noexcept |
| 移动赋值运算符 | |
| ~thread () | |
| 析构函数 | |
| NEFORCE_NODISCARD id | get_id () const noexcept |
| 获取线程标识符 | |
| NEFORCE_NODISCARD native_handle_type | native_handle () const noexcept |
| 获取原生句柄 | |
| NEFORCE_NODISCARD bool | joinable () const noexcept |
| 检查线程是否可被等待 | |
| void | join () |
| 等待线程结束 | |
| void | detach () |
| 分离线程 | |
| bool | set_name (const char *name) |
| 设置线程名称 | |
| bool | name (char *buffer, size_t size) const |
| 获取线程名称 | |
| void | swap (thread &other) noexcept |
| 交换两个线程对象 | |
静态 Public 成员函数 | |
| static bool | set_name (native_handle_type handle, const char *name) |
| 设置指定线程的名称 | |
| static bool | name (native_handle_type handle, char *buffer, size_t size) |
| 获取指定线程的名称 | |
|
defaultnoexcept |
|
inlineexplicit |
从可调用对象构造线程
| F | 可调用对象类型 |
| Args | 参数类型 |
| f | 要执行的可调用对象 |
| args | 传递给可调用对象的参数 |
| thread_exception | 如果线程创建失败 |
创建一个新线程,并在线程中执行带参数的可调用对象。
在文件 thread.hpp 第 302 行定义.
引用了 apply(), forward(), make_tuple(), move() , 以及 thread().
| thread::~thread | ( | ) |
析构函数
| void thread::detach | ( | ) |
|
inlinenoexcept |
| void thread::join | ( | ) |
|
inlinenoexcept |
| bool thread::name | ( | char * | buffer, |
| size_t | size ) const |
|
static |
|
inlinenoexcept |
| bool thread::set_name | ( | const char * | name | ) |
|
static |