首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

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

简介

二次

代码语言:javascript
复制
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

二次

代码语言:javascript
复制
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

二次

代码语言:javascript
复制
class thread::id {
 public:
    id() noexcept;
};

二次

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com