previous |
start |
next
Avoiding Deadlocks
- Call wait in add method:
public synchronized void
add(Object anObject)
throws InterruptedException
{
while (isFull())
wait();
}
- Waiting thread is blocked
- Waiting thread is added to wait set of object
previous |
start |
next