As we are finalizing the public draft document, I just want to review
the status of the wait/notify semantics, since there has been a lot
of email on it. These semantics are a change from the community
Basically, we do not allow lost notifications or interrupts. However,
we do allow spurious wakeups from wait.
* ordering: If a thread is both notified and interrupted while waiting, it
- return normally from wait, while still having a pending interrupt
(in other works, a call to Thread.interrupted() would return true)
- return from wait by throwing an InterruptedException
It may not:
- return normally from the call to wait, having swallowed the interrupt.
* We forbid lost notifications due to interrupts: Assume that a set S
is in the wait set of a monitor M, and another thread performs a notify on M.
* at least one thread in S must return normally from wait (i.e., not throw
* all of the threads in S must exit wait by throwing InterruptedException
* A call to wait may return normally at any time (a spurious wakeup). Spurious
wake-ups are allowed because standard techniques for avoiding lost
notifications in the face of interrupts.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:56 EDT