c++11 thread

 我看我们项目创建线程从来不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://*.com/questions/4508181/thread-destructors-in-c0x-vs-boost

c++11 thread,布布扣,bubuko.com

c++11 thread

上一篇:Java_NIO基础分析-1


下一篇:javascript 操作符类型隐性转换