[concurrency-interest] Re: interrupt / notify races even in 6.0beta?

Dawid Kurzyniec dawidk at mathcs.emory.edu
Tue May 16 10:59:51 EDT 2006

Bart Jacobs wrote:
> (...)
> Argument contra:
> - A reader could be forgiven for thinking that after a 
> notify()/interrupt() call, the target thread is not longer considered 
> to be waiting, and therefore, operations that happen-after the 
> notify()/interrupt() call do not occur "while [the target thread is] 
> waiting" and "could [not] cause it to be removed from a wait set". As 
> a result, neither 17.8.1 nor 17.8.4 would apply in the first place.

Exactly. My intuitive expectation would be that the call to interrupt() 
is synchronous, i.e. does not return until the thread has the interrupt 
flag set, and has been removed from the wait set. If that happened, the 
subsequent notify() from the same thread would have no effect. It seems 
that most JVMs currently implement interrupt() asynchronously, which 
leads to the possibility that the notify() shortly following interrupt() 
may succeed before the interrupt() finishes. If keeping the weaker 
asynchronous semantics is necessary due to practical purposes, I think 
it should be documented in Thread.interrupt() javadoc. Although I can't 
see what would be wrong with making interrupt synchronous?...


More information about the Concurrency-interest mailing list