thread::thread 构造函数

构造 thread 对象。

thread() _NOEXCEPT;
template<class Fn, class... Args>
   explicit thread(Fn&& F, Args&&... A);
thread(thread&& Other) _NOEXCEPT;

参数

  • F
    线程执行的应用程序中定义的函数。

  • A
    传递给参数列表 F。

  • Other
    一个现有的 thread 对象。

备注

第一构造函数构造与执行的线程的对象。 由对 get_id 的调用返回构造对象的值为 thread::id()

第二个构造函数构造与新的执行线程的对象并在 <functional>中定义的虚拟函数 INVOKE。 如果没有足够的资源可用启动新线程,函数有引发 resource_unavailable_try_again错误代码的对象。system_error 如果对 F 的调用未终止使用异常,终止 调用。

第三个构造函数构造与线程关联的 Other对象。 Other 然后将添加到默认构造的状态。

要求

标头: 线程

命名空间: std

请参见

参考

thread 类

<thread>

thread::id 类