RE: JavaMemoryModel: Proposals on wait and interrupts

From: Sylvia Else (
Date: Tue May 27 2003 - 07:56:01 EDT

At 08:56 PM 27/05/2003 +1000, David Holmes wrote:
>For example,
> synchronized void someBlockingMethod() throws InterruptedException
> while (!inRightState)
> wait();
> // do something
> }
>Under the existing spec an interrupt while waiting will propagate
>straight out of the method.


If spurious wakeups are permitted, then this code is broken if the
interrupting thread does not have the same monitor locked, because a
spurious wakeup could occur immediately before the interrupt, resulting in
the loop back to the inRightState test. So your objection only really
applies if the interrupting thread has the same monitor locked. I'm
wondering whether anything can be made of that...


JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:45 EDT