[concurrency-interest] spurious wakeups semantics

David J. Biesack David.Biesack at sas.com
Sat Oct 29 13:47:58 EDT 2005

Can someone clarify the semantics of spurious wakeup as noted in java.lang.Object wait() in Java 5?

What happens to the monitor that the thread is waiting on? If another thread T2 has the lock
and a waiting thread T1 wakes up "suriously", what happens to thread T2? Are both threads T1 and T2 now
running, and what risks are there of race conditions? I understand that wait must be guarded
by a loop, but is it not possible that the wait condition is no longer safe from concurrent update?
Do variables used for wait conditions have to be volatile, for example?

David J. Biesack     SAS Institute Inc.
(919) 531-7771       SAS Campus Drive
http://www.sas.com   Cary, NC 27513

More information about the Concurrency-interest mailing list