Windows c++ 简单多线程
//****************************************
//c++多线程
//首次编辑时间:2020/06/18
//最后修改时间:2020/06/18
//****************************************
#include"iostream"
#include"thread"
using namespace std;
void go();
int main()
{
thread(go).detach();//新线程直接运行,主线程不等待
_sleep(500);//等待500ms
/*
thread(go).join();//主线程阻塞,等待新线程运行结束
*/
return 0;
}
void go()
{
cout << this_thread::get_id << endl;
}