[concurrency-interest] spurious wakeups semantics
dholmes at dltech.com.au
Mon Oct 31 16:58:44 EST 2005
Ernst, Matthias writes:
> No, it's the other way around: T2 continues to hold the lock, so T1
> cannot acquire it _yet_. It has to wait until T2 releases the lock.
> It's a spontaneous transition from "waiting on xxx" to
> "trying to enter xxx".
I see that the documentation for Object.wait() is a bit unclear on this. It
treats all the normal causes for wait returning and states:
"The thread T is then removed from the wait set for this object and
re-enabled for thread scheduling. It then competes in the usual manner with
other threads for the right to synchronize on the object"
but the mention of spurious wakeup follows that and doesn't make it clear
exactly what happens. Spurious wakeup should just be another bullet in the
list along with notify, notifyall, interruption and timeout.
More information about the Concurrency-interest