AMDG Ovanes Markarian wrote:
Did you test it? In my case wait returns when the predicate is false. I use an empty circular buffer and call from the same thread this code:
using namespace boost;
scoped_lock lock(mutex_); wait_for_free_slots_.wait(lock, bind(&buffer_type::full, buffer_)); //wait_for_free_slots_ is a condition variable
buffer_.push_back(item); wait_for_items_.notify_all();
This line returns immediately wait_for_free_slots_.wait(lock, bind(&buffer_type::full, buffer_)); //wait_for_free_slots_ is a condition variable
If you inverse the predicate it blocks forever.
Seems to work for me
#include