How do java.util.concurrent.locks.Condition work?
问题 Reading the Java 8 documentation about the java.util.concurrent.locks.Condition interface, the following example is given: class BoundedBuffer { final Lock lock = new ReentrantLock(); final Condition notFull = lock.newCondition(); final Condition notEmpty = lock.newCondition(); final Object[] items = new Object[100]; int putptr, takeptr, count; public void put(Object x) throws InterruptedException { lock.lock(); try { while (count == items.length) notFull.await(); items[putptr] = x; if (+