$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: William Kempf (sirwillard_at_[hidden])
Date: 2000-08-10 17:11:12
--- In boost_at_[hidden], jsiek_at_l... wrote:
> scleary_at_j... writes:
> > > As for the predicate to remove the while... I considered that
a lot
> > > yesterday while thinking on this subject. The only problem I
see is
> > > that you don't always have a predicate or while loop.
> >
> > Right! Condition variables can also be used on their own. I've
used them
> > in that way before. The example given by Jeremy was using CV's
as a
>
> I'm not familiar with the usage scenario you're alluding to
> here. Could you give an example?
To implement a gate. If the gate is closed you wait on the
condition, but once the condition is signaled there isn't really a
reason to retest to see if the gate is opened. This is just one
simple example.
> > monitor, not as CV's in their own right. I'd recommend leaving
pthread CV's
> > largely as-is, but adding a Monitor class that wraps the while
Predicate
> > loop.
>
> I'm not sure I like the use of the word "monitor" in this sense.
I've
> always thought that a monitor is a class that automatically
serializes
> accesses to its member functions. I know that signal() and wait()
were
> discussed in Hoare's paper, but I thought he was using "condition
> variable" for that part of the functionality.
Yes, Hoare used a CV. In this sense a monitor is really just a
programming idiom. However, a monitor can be a first class object as
well. Some are proposing that this is the only synchronization type
that we need.