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.
Hmm...
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...
Sylvia.
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:45 EDT