I have the following code: where m_event is a boost::condition_variable
boost::scoped_lock dummy;
boost::unique_lock<boost::scoped_lock> lock(dummy); // TODO: see if dummy is correct
m_event.wait(lock, [this] () {
return !this ->m_enqueue.empty();
});
I don't really need that dummy locker I just want the event to stop upon a certain boolean condition, do I not understand something?
Why am I forced to use the dummy lock?
(P.S. code works great..)
EDIT: In fact if I understood correctly, what I have in my class is a boost::mutex, let's call it m_mtx and obvious inserters to the m_enqueue.. so I am changing my implementation accordingly to the lock to lock on m_lock and then the inserters would only do:
boost::mutex::scoped_lock<boost::mutex> guard(m_lock);
make sense?