码迷,mamicode.com
首页 > 编程语言 > 详细

C++11 thread

时间:2016-06-21 01:07:49      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

 1 //这里使用c++的thread创建了5个线程,并支持传递多个参数
 2 void thread1(int aa,int bb)
 3 {
 4     cout << aa << bb << endl;
 5 }
 6 
 7 void testthread()
 8 {
 9     int ithreads[] = {1,2,3,4,5};
10     for(auto i: ithreads)
11     {
12         thread t1(thread1,i,i+1);
13         t1.join();
14     }
15 }

 

C++11 thread

标签:

原文地址:http://www.cnblogs.com/codetask/p/5602289.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!