This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
Re: [SCM] master: Avoid spurious waits in CountDownLatch.await
- From: Mark Wielaard <mark at klomp dot org>
- To: frysk at sourceware dot org
- Cc: Tim Moore <timoore at redhat dot com>
- Date: Fri, 23 Nov 2007 10:40:57 +0100
- Subject: Re: [SCM] master: Avoid spurious waits in CountDownLatch.await
- References: <20071122205327.10260.qmail@sourceware.org>
Hi Tim,
On Thu, 2007-11-22 at 20:53 +0000, moore@sourceware.org wrote:
> 2007-11-22 Tim Moore <timoore@redhat.com>
>
> * CountDownLatch.java (await): Loop to avoid spurious wakeup.
Using wait() and notify() are such a pain :{
Good you caught this one.
Using higher order concurrent primitives is good.
There are some other non-guarded wait()s in some of the stepping command
(StepInstructionCommand, StepNextCommand, StepNextiCommand), which all
have something like:
synchronized (cli.steppingObserver.getMonitor())
{
try
{
//XXX This looks racy.
cli.steppingObserver.getMonitor().wait();
}
catch (InterruptedException ie) {}
}
The XXX comment is right :{
If you are cleaning this up anyway you might want to abstract away all
the logic about guarding the mutex into the steppingObserver.
Cheers,
Mark