Versions Compared

Key

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

The wait() method is employed to temporarily cede possession of a lock so that another thread can proceed. It must always be used inside a synchronized block. To resume activity, the other thread must notify the waiting thread. Moreover, the wait() method should be invoked in a loop that checks if a condition predicate holds.

...