Code example for Condition

Methods: await

0
    public void pass() { 
        lock.lock();
        if(!open){
//            threadSwitchCondition.awaitUninterruptibly(); 
            try { 
                threadSwitchCondition.await();
            } catch (InterruptedException e) {
                e.printStackTrace();
            } 
        } 
        lock.unlock();
     } 
     
    public void open(){ 
        lock.lock();
        if(!open){
            open = true;
            threadSwitchCondition.signalAll(); 
        } 
        lock.unlock();
    }