您的位置:首页 > 编程语言 > C语言/C++

第一个 c++11多线程

2015-11-18 22:47 274 查看
// Consolehello.cpp : 定义控制台应用程序的入口点。

//

#include "stdafx.h"

#include <thread>

#include <iostream>

#include <boost\smart_ptr\shared_ptr.hpp>

void hello()

{
std::cout<<"hello"<<std::endl;

}

int _tmain(int argc, _TCHAR* argv[])

{
for(int k = 0 ; k < 10 ; k++)
{
std::auto_ptr<std::thread> test(new std::thread(hello));

boost::shared_ptr<std::thread> te(new std::thread(hello));
test->join();
te->join();
}
return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c++