#include <thread>
#include<iostream>
using namespace std;
void main_3(){
int res=0;
int a=234;
int b=234;
thread myt([&res,&a,&b](){
res=a+b;
cout<<"computed a+b"<<endl;
});
cout<<"computed a+b: "<<res<<endl;
myt.join();
cout<<"computed a+b: "<<res<<endl;
}
c++lamba表达式获取线程执行结果
最新推荐文章于 2024-08-17 23:59:05 发布