Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-08-11 15:41:17


From: "William Kempf" <sirwillard_at_[hidden]>
> ...
> > > I also don't know why you used a class for waiting. The only
> benefit
> > > this gave you in your example was the fact that you could name
> the
> > > wait. However, the CV and predicate should have been enough for
> this.
> >
> > The main benefit is that the wait destructor signals the
> > condition. So the wait class privides a shorthand for:
> >
> > while (predicate())
> > entry_condition.wait();
> > try {
> >
> > // ...
> >
> > } catch (...) {
> > exit_condition.signal();
> > throw;
> > }
> > condition.signal();
        ^^^^^^^^^
Typo: ^^^^^^^^^
        exit_condition
 
> *confused* Why should you signal the condition after waiting for
> it? That sounds to me like you'll just wind up with a "busy wait"
> when you have multiple threads waiting on the condition. Or am I
> missing something?


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