在C ++中使用以下内容:
#include <mutex>std::mutex _mutex;void f(){ std::unique_lock<std::mutex> lock(_mutex); // access your resource here.}
在C ++中使用以下内容:
#include <mutex>std::mutex _mutex;void f(){ std::unique_lock<std::mutex> lock(_mutex); // access your resource here.}