首页 > TAG信息列表 > adopt

unique_lock加锁adopt_lock

#include <iostream> #include <mutex> #include <thread> std::mutex mutex; void msg_func() { mutex.lock(); std::unique_lock<std::mutex> unique(mutex, std::adopt_lock); while(1) { std::cout << "do somet