This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SCM] master: Avoid spurious waits in CountDownLatch.await


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]