Avoiding Deadlocks

Calling await on a condition object makes the current thread wait and allows another thread to acquire the lock.

A waiting thread is blocked until another thread calls signallAll or signal on the condition object for which the thread is waiting.