thread::detach方法

分离关联的线程。 操作系统将负责释放在终止的线程资源。

void detach();

备注

在对 detach的调用,对的后续调用 get_id 后返回 id

如果与调用对象的线程不 joinable,具有 invalid_argument错误代码的函数引发 system_error

如果与调用对象的线程是无效的,则 no_such_process错误代码的函数引发 system_error

要求

**标头:**线程

**命名空间:**std

请参见

参考

thread Class

<thread>