#include <iostream>
#include <boost/thread.hpp>
using namespace std;
void func()
{
cout<<"Hello World"<<endl;
}
//线程的创建
int main()
{
boost::thread t1(func);
t1.join();//阻塞等func执行完毕后返回
t1.detach();//不阻塞,直接返回
system("pause");
return 0;
}#include <iostream>
#include <boost/thread.hpp>