C++多线程编程——通过lambda表达式创建线程
int main()
{
auto myLamThread = [] {
cout << "线程开始运行" << endl;
cout << "线程结束运行" << endl;
};
thread cthread(myLamThread);
cthread.join();
std::cout << "see you " << endl;
return 0;
}
int main()
{
auto myLamThread = [] {
cout << "线程开始运行" << endl;
cout << "线程结束运行" << endl;
};
thread cthread(myLamThread);
cthread.join();
std::cout << "see you " << endl;
return 0;
}
相关推荐