Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot

...

Code Block
synchronized (object) {
  while (&lt;condition<condition does not hold&gt;hold>) {
    object.wait(); 
  }

  // Proceed when condition holds
}

...

Code Block
bgColor#FFcccc
synchronized(object) {
  if(&lt;condition<condition does not hold&gt;hold>)
    object.wait();
  //proceed when condition holds
}

...

Code Block
bgColor#ccccff
// Condition predicate is guarded by a lock on the shared object/variable
synchronized (object) {
  while (&lt;condition<condition does not hold&gt;hold>) {
    object.wait(); 
  }

  // Proceed when condition holds
}

...

CON30-J. Synchronize access to shared mutable variables&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      11. Concurrency (CON)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      CON32-J. Use notifyAll() instead of notify() to resume waiting threads