My proposed solution for this is not quite right.
The notify method has to invoke notifySpecial, passing the current value of
the counter, otherwise it can steal a thread needed by another
notifySpecial invocation with a smaller counter.
This means that the wait set is effectively a list of groups of threads,
where each group in the list represents the threads that waited between two
successive invocations of notify. The list of groups is LIFO. This directly
suggests another way of implementing this, which doesn't use counters, but
passes to the interrupted thread a reference to the group at which it
should start looking for a thread to notify in place of itself.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:54 EDT