Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-thread] error in the docs???
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-18 19:13:28


AMDG

Ovanes Markarian wrote:
> I think there is an error in the docs at:
> http://www.boost.org/doc/libs/1_38_0/doc/html/thread/synchronization.html#thread.synchronization.condvar_ref
>
> Member Function of condition_variable class is documented as:
>
> template<typename predicate_type> void
> wait(boost::unique_lock<boost::mutex>& lock, predicate_type pred)
>
> Effects:
>
> As-if
>
> while(!pred())
> {
> wait(lock);
> }
>
>
> Should be:
>
> template<typename predicate_type> void
> wait(boost::unique_lock<boost::mutex>& lock, predicate_type pred)
>
> Effects:
>
> As-if
>
> while(pred()) //!!!!! no not operator
> {
> wait(lock);
> }
>
> If I pass the negated predicate to the wait, my thread blocks forever,
> whereas passing the predicate works as intended.
> This applies to the version 1.36, but 1.38 states the same in the docs.
>

wait returns when the predicate is true, so the docs are correct.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net