[concurrency-interest] spurious wakeups semantics
josh at bloch.us
Sat Oct 29 13:56:12 EDT 2005
Any wakeup, spurious or otherwise, is followed by acquisition of the
intrinsic lock on the object being waited on. There is no race
condition, and no need for a volatile variable.
On 10/29/05, David J. Biesack <David.Biesack at sas.com> wrote:
> 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
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
More information about the Concurrency-interest