STD::unique_loc<std::mutex>
如果在用作线程函数的 lambda 函数中捕获 a 是否有任何潜在问题?例如:
int foo()
{
std::mutex mtxRunOver;
std::unique_lock <std::mutex> ulkRunOver(mtxRunOver);
std::thread workThread([&](){
workThread.detach();
do_some_process_for_seconds();
}
);
do_some_work();
}