Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-08-11 18:40:03


William Kempf writes:
>
> class mutex
> {
> public:
> typedef basic_lock<mutex> lock;
> typedef basic_trylock<mutex> trylock;
> typedef basic_timedlock<mutex> timedlock;
> typedef basic_condition<mutex> condition;
>
> mutex();
> };

I agree that the mutex type needs to be tied to the condition
type, but it doesn't seem right to nest the condition type in the
mutex type. Perhaps the condition class should have a typedef
for the mutex type, and use the explicit lock types in the
implementation of wait(). Or maybe we should have a separate traits
class.

> while (!full)
> lock.wait(cv);

while (!full)
  cv.wait(lock);

makes a little more sense to me.

I've got a preliminary write up of ConditionVariable with this
interface, incuding the buffer example (which was compiled
and run using KCC and Solaris threads).

http://www.lsc.nd.edu/~jsiek/ConditionVariable.html

Cheers,

Jeremy


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