首页 > 编程语言 > 详细

c++11 thread

时间:2014-07-10 13:55:49      阅读:340      评论:0      收藏:0      [点我收藏+]

 我看我们项目创建线程从来不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

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

c++11 thread

原文:http://www.cnblogs.com/zzyoucan/p/3811692.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!