标签:
错误提示:Segmentation fault!
解决办法:
错误提示:Segmentaion fault!
解决方法:
错误提示::terminate called without an active exception. Aborted
解决办法:
void foo()
{
//do something;
}
int main()
{
std::thread t(foo);
if(true)return1;
t.join();
return0;
}
代码8时t以foo构造并运行,此是为joinable状态,代码9时程序退出,导致t在t.join()之前析构,thread在joinable状态析构下会导致terminate。~thread函数在cplusplus说明如下:
If the thread is joinable when destroyed, terminate() is called.
标签:
原文地址:http://www.cnblogs.com/arhlong/p/5367255.html