boost :: scoped线程是否自动分离

时间:2015-04-27 13:36:23

标签: c++ boost

boost :: scoped线程是否自动分离或必须手动分离。

#include <boost/thread.hpp>
#include <boost/thread/scoped_thread.hpp>
#include <iostream>

void thread()
{
    for (int i = 0; i != 10000; ++i)
    {
        std::cout << i << std::endl;
    }
}

int main()
{
      boost::scoped_thread<> t{boost::thread{thread}};
      // Do I need t.detach() here
      // Some code from main function
      return EXIT_SUCCESS;
}

0 个答案:

没有答案