Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that when thread 2 goes into the wait state, the condition predicate of thread 1 becomes false. When notify() is invoked by thread 3, it can be delivered to either thread 1 or thread 2 depending on the particular Java Virtual Machine (JVM). If thread 1 is chosen to be notified, its condition turns out to be false which terminates it. This is the required functionality, that is, any thread whose condition predicate is false must be terminated. However, if the notification is delivered to thread 2, it has no effect because its condition predicate is still true, and it goes into the wait state once again. Consequently, thread 1 continues to wait despite its condition predicate being false and is not terminated in this case.

...