Why must wait() always be in synchronized block
What is the potential damage if it was possible to invoke wait() outside a synchronized block, retaining it’s semantics – suspending the caller thread? Let’s illustrate what issues we would run into if wait() could be called outside of a synchronized block with a concrete example. Suppose we were to implement a blocking queue (I … Read more