摘要: void function(); void function1(); std::thread t1( function ); //启动一个新线程t1与function关联 std::thread t2 = std::move(t1); //将t1限行的转移给t2 t1 = std::thread( 阅读全文
posted @ 2019-09-04 19:49 penuel 阅读(243) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <thread>#include <windows.h> using namespace std;void switch_ab (int &a, int &b) //参数是引用可更改 //void switch_ab (int &a, int 阅读全文
posted @ 2019-09-04 19:22 penuel 阅读(337) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <thread>#include <unistd.h>void hello(){ while(1) { std::cout << "hello world" << std::endl; for(int i=0;i<999999999;i++); 阅读全文
posted @ 2019-09-04 19:11 penuel 阅读(180) 评论(0) 推荐(0) 编辑