
1 Dec
2006
1 Dec
'06
1:33 a.m.
On 01/12/06, Yuval Ronen <ronen_yuval@yahoo.com> 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:
#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() Regards, Matt.