38.线程交换与线程移动

 1 #include <iostream>
 2 #include <thread>
 3 using namespace std;
 4 
 5 //交换线程,线程移动
 6 void main()
 7 {
 8     thread t1([]() {cout << "hello" << endl; });
 9     thread t2([]() {cout << "hello3" << endl; });
10     //交换线程
11     swap(t1, t2);
12     thread t3 = move(t1);//线程移动,t2具备t1的属性
13     cin.get();
14 }

 

posted @ 2018-03-12 15:49  喵小喵~  阅读(142)  评论(0编辑  收藏  举报