标签:des style blog http color os
我看我们项目创建线程从来不join,detach
#include <iostream> #include <thread> #include <windows.h> #include <boost/thread/thread.hpp> void fun() { while (true) { std::cout << "hehhe" << std::endl; } } int main() { std::thread th(fun); boost::this_thread::interruptible_wait(5000); TerminateProcess(GetCurrentProcess(), 0); return 0; }
这个疑问很久了
终于解决了,参考这个:
http://stackoverflow.com/questions/4508181/thread-destructors-in-c0x-vs-boost
标签:des style blog http color os
原文地址:http://www.cnblogs.com/zzyoucan/p/3811692.html