...
| Code Block |
|---|
synchronized (object) {
while (<condition<condition does not hold>hold>) {
object.wait();
}
// Proceed when condition holds
}
|
...
| Code Block | ||
|---|---|---|
| ||
synchronized(object) {
if(<condition<condition does not hold>hold>)
object.wait();
//proceed when condition holds
}
|
...
| Code Block | ||
|---|---|---|
| ||
// Condition predicate is guarded by a lock on the shared object/variable
synchronized (object) {
while (<condition<condition does not hold>hold>) {
object.wait();
}
// Proceed when condition holds
}
|
...
CON30-J. Synchronize access to shared mutable variables 11. Concurrency (CON) CON32-J. Use notifyAll() instead of notify() to resume waiting threads