std::mutex mymutex; std::lock_guard<std::mutex> lock(mymutex); 转载于:https://www.cnblogs.com/swordenchanter/p/9989387.html