what's the job of std::unique_lock when used with std::conditional_variable::wait()
- by Mike
I'm quite confused with the need of a std::unique_lock when wait a std::conditional_variable. So I look into the library code in VS 2013 and get more confused. This is how std::conditional_variable::wait() implemented:
void wait(unique_lock<mutex>& _Lck)
{ // wait for signal
_Cnd_waitX(&_Cnd, &_Lck.mutex()->_Mtx);
}
Is this some kind of joke? Wrap a mutex in a unique_lock and do nothing but get it back latter? Why not just use mutex in the parameter list?