thread
标准库标头<thread>
此标头是螺纹支撑图书馆。
班
*。
线程%28C++11%29管理单独的线程%28class%29
功能
交换%28std::线程%29%28C++11%29专门使用std::swp算法%28函数模板%29
运算符==运算符%21=运算符<运算符<=运算符>>=比较两个线程::id对象%28功能%29
运算符<<序列化线程::id对象%28函数模板%29
std::散列<std::线程::id>专门化std::散列%28类模板专门化%29
命名空间
这[医]线程提供访问当前执行线程的函数。
功能
在命名空间std中定义::[医]螺纹
产率%28C++11%29建议重新安排线程的执行时间%28功能%29
弄到[医]ID%28C++11%29返回当前线程%28函数%29的线程id
睡眠[医]对于%28C++11%29,在指定的持续时间内停止当前线程的执行
睡眠[医]直到%28C++11%29停止当前线程的执行,直到指定的时间点%28功能%29
简介
二次
namespace std {
class thread;
void swap(thread& x, thread& y) noexcept;
bool operator==(thread::id x, thread::id y) noexcept;
bool operator!=(thread::id x, thread::id y) noexcept;
bool operator<(thread::id x, thread::id y) noexcept;
bool operator<=(thread::id x, thread::id y) noexcept;
bool operator>(thread::id x, thread::id y) noexcept;
bool operator>=(thread::id x, thread::id y) noexcept;
template<class CharT, class Traits>
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& out,
thread::id id
template <class T> struct hash;
template <> struct hash<thread::id>;
namespace this_thread {
thread::id get_id() noexcept;
void yield() noexcept;
template <class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time
template <class Rep, class Period>
void sleep_for(const chrono::duration<Rep, Period>& rel_time
}
}
二次
类std::thread
二次
class thread {
public:
// types:
class id;
typedef /*implementation-defined*/ native_handle_type;
// construct/copy/destroy:
thread() noexcept;
template <class F, class ...Args> explicit thread(F&& f, Args&&... args
~thread(
thread(const thread&) = delete;
thread(thread&&) noexcept;
thread& operator=(const thread&) = delete;
thread& operator=(thread&&) noexcept;
// members:
void swap(thread&) noexcept;
bool joinable() const noexcept;
void join(
void detach(
id get_id() const noexcept;
native_handle_type native_handle(
// static members:
static unsigned hardware_concurrency() noexcept;
};
二次
类std::thread::id
二次
class thread::id {
public:
id() noexcept;
};
二次
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。