Neel Basu
Neel Basu

Reputation: 12904

no matching function for call to boost::condition_variable::wait

This is my scenario

boost::condition_variable        _condition;
boost::unique_lock<boost::mutex> lock(_mutex);
boost::detail::atomic_count      _count;
.........
_condition.wait(&lock, boost::bind(std::less<int>(), boost::ref(_count), max));

Getting error

error: no matching function for call to 'boost::condition_variable::wait(boost::unique_lock<boost::mutex>*, boost::_bi::bind_t<boost::_bi::unspecified, std::less<int>, boost::_bi::list2<boost::reference_wrapper<boost::detail::atomic_count>, boost::_bi::value<short unsigned int> > >)'

Where is the problem ?

Upvotes: 1

Views: 4399

Answers (1)

Sam Miller
Sam Miller

Reputation: 24174

condition_variable::wait() accepts a single argument

void wait(boost::unique_lock<boost::mutex>& lock)

or the two argument case with a predicate type

template<typename predicate_type> void wait(boost::unique_lock<boost::mutex>& lock, predicate_type pred)

In either case, the first argument is a reference not a pointer as in your example.

Upvotes: 1

Related Questions