How to use/create unique_lock in c++?
问题 Please, can anybody explain how to use and create an unique_lock in c++? It should be used both to get mutual exclusion to any procedure of the monitor and to be able to perform wait() on the condition variable...I'm not understanding from the documentation how I am supposed to create it. Is necessary a mutex? Here is a pseudo-code: /* compile with g++, flags -std=c++0x -lpthread */ #include <condition_variable> #include <mutex> #include <thread> #include <iostream> #include <string.h>