std::thread::~thread
来自cppreference.com
并发支持库
|
|
~thread(); | (C++11 起) | |
销毁线程对象。
若 *this 拥有关联线程(joinable() == true),则调用 std::terminate()。
注解
在下列操作后线程对象无关联的线程(从而可安全销毁)
示例
运行此代码
#include <thread> using namespace std::chrono_literals; int main() { auto bleah = std::thread{[]{ std::this_thread::sleep_for(13ms); }}; } // ~thread 调用 std::terminate()
可能的输出:
terminate called without an active exception
参阅
如果线程可合并,那么请求停止然后合并此线程。 ( std::jthread 的公开成员函数) |