private void idleAwaitWork(WorkQueue w,long currentCtl,long prevCtl){
  if (w != null && w.eventCount < 0 && !tryTerminate(false,false) && (int)prevCtl != 0) {
    int dc=-(short)(currentCtl >>> TC_SHIFT);
    long parkTime=dc < 0 ? FAST_IDLE_TIMEOUT : (dc + 1) * IDLE_TIMEOUT;
    long deadline=System.nanoTime() + parkTime - TIMEOUT_SLOP;
    Thread wt=Thread.currentThread();
    while (ctl == currentCtl) {
      Thread.interrupted();
      U.putObject(wt,PARKBLOCKER,this);
      w.parker=wt;
      if (ctl == currentCtl)       U.park(false,parkTime);
      w.parker=null;
      U.putObject(wt,PARKBLOCKER,null);
      if (ctl != currentCtl)       break;
      if (deadline - System.nanoTime() <= 0L && U.compareAndSwapLong(this,CTL,currentCtl,prevCtl)) {
        w.eventCount=(w.eventCount + E_SEQ) | E_MASK;
        w.qlock=-1;
        break;
      }
    }
  }
}

private void idleAwaitWork ( WorkQueue w , long currentCtl , long prevCtl ) { if ( w != null && w . eventCount < 0 && ! tryTerminate ( false , false ) && ( int ) prevCtl != 0 ) { int dc = - ( short ) ( currentCtl > > > TC_SHIFT ) ; long parkTime = dc < 0 ? FAST_IDLE_TIMEOUT : ( dc + 1 ) * IDLE_TIMEOUT ; long deadline = System . nanoTime ( ) + parkTime - TIMEOUT_SLOP ; Thread wt = Thread . currentThread ( ) ; while ( ctl == currentCtl ) { Thread . interrupted ( ) ; U . putObject ( wt , PARKBLOCKER , this ) ; w . parker = wt ; if ( ctl == currentCtl ) U . park ( false , parkTime ) ; w . parker = null ; U . putObject ( wt , PARKBLOCKER , null ) ; if ( ctl != currentCtl ) break ; if ( deadline - System . nanoTime ( ) <= 0L && U . compareAndSwapLong ( this , CTL , currentCtl , prevCtl ) ) { w . eventCount = ( w . eventCount + E_SEQ ) | E_MASK ; w . qlock = - 1 ; break ; } } } }
if inactivating worker w has caused the pool to become quiescent , checks for pool termination , and , so long as this is not the only worker , waits for event for up to a given duration . on timeout , if ctl has not changed , terminates the worker , which will in turn wake up another worker to possibly repeat this process .
