private void releaseWaiters ( int phase ) { QNode q ; // first element of queue Thread t ; // its thread AtomicReference < QNode > head = ( phase & 1 ) == 0 ? evenQ : oddQ ; while ( ( q = head . get ( ) ) != null && q . phase != ( int ) ( root . state >>> PHASE_SHIFT ) ) { if ( head . compareAndSet ( q , q . next ) && ( t = q . thread ) != null ) { q . thread = null ; LockSupport . unpark ( t ) ; } } }
Removes and signals threads from queue for phase .