|
Boost : |
From: jsiek_at_[hidden]
Date: 2000-08-14 08:39:29
William Kempf writes:
> I think it makes as much sense to nest the CV as it does the lock.
> The CV can't exist with out the mutex, while the mutex can exist
> withou the CV. Further, the CV is going to be as dependent
> [ clip ]
> > > while (!full)
> > > lock.wait(cv);
> >
> > while (!full)
> > cv.wait(lock);
> >
> > makes a little more sense to me.
>
> It makes more sense because it follows the logic of the pthreads
> implementation. However, I think it makes sense to reverse them in
> our own library because the lock is waiting on the condition.
The fact that the Mutex concept can exist without the CV concept is an
argument for my position, not yours ;) The Mutex concept should not
make any mention of a CV. Having a CV typedef nested in Mutex, or
having a wait() function in the Mutex's lock would make the Mutex
concept dependent on the CV concept, which is the opposite of what we
want. We want tight coupling, but it should go in the other direction.
-Jeremy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk