question: public void await ( int ID ) throws InterruptedException { if ( parties == 1 ) return ; final boolean startCondition = competitionCondition ; int competingFor = ( locks . length * 2 - 1 - ID ) / 2 ; while ( competingFor >= 0 ) { final Lock node = locks [ competingFor ] ; if ( node . tryLock ( ) ) { synchronized ( node ) { while ( competitionCondition == startCondition ) node . wait ( ) ; } node . unlock ( ) ; wakeUpTarget ( competingFor * 2 + 1 ) ; wakeUpTarget ( competingFor * 2 + 2 ) ; return ; } else { if ( competingFor == 0 ) break ; competingFor = ( competingFor - 1 ) / 2 ; } } competitionCondition = ! competitionCondition ; wakeUpTarget ( 0 ) ; }
target:  Waits for all threads to reach this barrier. 