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 Class

<thread>

thread::id选件类