#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-05-24 13:15:34 发布