I was reading the difference between a lock_guard and a unique_lock and I found out that a unique_lock is an enhanced version of a lock_guard. Such that with a unique lock a lock can always be deferred.I was reading this article and I came across the boost::lock. I wanted to know how I can use this method. I tried the following :
boost::mutex mutx;
boost::unique_lock<boost::mutex> guard (mutx,boost::defer_lock);
boost::lock(guard); //too few arguments in function call.
I would appreciate it if someone could explain to me what boost::lock does and how it works.Thanks