C++ 线程和线程指针 简单示意

 1 #include <iostream>
 2 #include <thread>
 3 
 4 void Func()
 5 {
 6     std::cout << "hello" << std::endl;
 7 }
 8 
 9 int main()
10 {
11     //ok
12     //std::thread tmp(Func);
13     //tmp.join();
14 
15     //ok
16     std::thread *tmp = new std::thread(Func);
17     tmp->join();
18     delete tmp;
19 }

 

posted @ 2022-07-26 14:12  小小林林  阅读(116)  评论(0编辑  收藏  举报