[concurrency-interest] JCiP Condition Queues

Alexandru Popescu the.mindstorm.mailinglist at gmail.com
Sat Nov 4 11:59:45 EST 2006


On 11/4/06, Tim Peierls <tim at peierls.net> wrote:
> On 11/4/06, Alexandru Popescu
> <the.mindstorm.mailinglist at gmail.com> wrote:
> > For me it looks like the code can be written like:
> >
> > [code]
> > if(wasEmpty) {
> >    notify(); // was empty and now I have 1 element => only 1 consumer can
> really do something
> > }
> > else {
> >    notifyAll(); // there is no problem to awake multiple threads... we
> have plenty of elements
> > }
> > [/code]
> >
>
> "Only one consumer can really do something" but there's no guarantee that
> the thread that is woken up will be a consumer thread, i.e., a thread doing
> take() rather than put(). That's the reason for the "uniform waiters"
> condition on p.303.
>

That was it :-)). Once again, many many thanks Tim.

./alex
--
.w( the_mindstorm )p.


> --tim
>


More information about the Concurrency-interest mailing list