Boost logo

Boost :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2006-12-01 04:24:46


Matt Hurd wrote:
>> On 01/12/06, Yuval Ronen <ronen_yuval_at_[hidden]> wrote:
> <snip>
>> If there aren't any, then why
>> wouldn't the CV interface be changed to do the while loop itself:
>>
>> template <typename Lock, typename Pred>
>> void condition::wait(Lock &lock, Pred while_cond)
>> {
>> while (while_cond)
>> {
>> old_wait(lock);
>> }
>> }
>>
>> or something similar.
>>
>> Does that make sense?
>
> Good sense. It is so:
>
>>From http://www.boost.org/doc/html/condition.html
>
> #2 template<typename ScopedLock, typename Pred>
> void wait(ScopedLock& lock, Pred pred);
>
> Requires: ScopedLock meets the ScopedLock requirements and the return
> from pred() is convertible to bool.
> Effects: As if: while (!pred()) wait(lock)
> Throws: lock_error if !lock.locked()

Oops, didn't notice that!
Stupid me...

While we're at that doc page, there's a mistake at the second timed_wait
overload - it's documented to accept (ScopedLock& lock, Pred pred) while
it actually accepts (ScopedLock& lock, const boost::xtime& xt, Pred
pred) - the xtime parameter is missing.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk