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

[c++11多线程]01

时间:2019-10-20 00:43:06      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:bsp   process   second   ice   having   why   style   color   col   

 

 1 #include <QCoreApplication>
 2 
 3 
 4 //1.Approaches to concurrency
 5 //  Each developer represents a thread,and each office represents a process
 6 //--<1>The first approach is to have multiole single-threaded processes --> concurrency with multiple processes
 7 //      ,which is similar to having each developer in threir own office.
 8 //--<2># focus on #The second approach is to have multiple threads in a single process,-->concurrency with multiple threads
 9 //      ,which is like having two developers in the same office.
10 
11 
12 //2.Why use concurrency?
13 //<1>separation of concerns
14 //<2>performance
15 
16 #include <iostream>
17 #include <thread>
18 
19 using namespace std;
20 
21 void hello()
22 {
23     cout<<"say hello"<<endl;
24 }
25 int main(int argc, char *argv[])
26 {
27     QCoreApplication a(argc, argv);
28 
29     thread t(hello);
30     t.join();
31 
32 
33     return a.exec();
34 }

 

[c++11多线程]01

标签:bsp   process   second   ice   having   why   style   color   col   

原文地址:https://www.cnblogs.com/tailiang/p/11706311.html

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