private int awaitWork(WorkQueue w){
  int stat=0;
  if (w != null && w.scanState < 0) {
    long c=ctl;
    if ((int)(c >> AC_SHIFT) + (config & SMASK) <= 0)     stat=timedAwaitWork(w,c);
 else     if ((runState & STOP) != 0)     stat=w.qlock=-1;
 else     if (w.scanState < 0) {
      w.parker=Thread.currentThread();
      if (w.scanState < 0)       LockSupport.park(this);
      w.parker=null;
      if ((runState & STOP) != 0)       stat=w.qlock=-1;
 else       if (w.scanState < 0)       Thread.interrupted();
    }
  }
  return stat;
}

private int awaitWork ( WorkQueue w ) { int stat = 0 ; if ( w != null && w . scanState < 0 ) { long c = ctl ; if ( ( int ) ( c > > AC_SHIFT ) + ( config & SMASK ) <= 0 ) stat = timedAwaitWork ( w , c ) ; else if ( ( runState & STOP ) != 0 ) stat = w . qlock = - 1 ; else if ( w . scanState < 0 ) { w . parker = Thread . currentThread ( ) ; if ( w . scanState < 0 ) LockSupport . park ( this ) ; w . parker = null ; if ( ( runState & STOP ) != 0 ) stat = w . qlock = - 1 ; else if ( w . scanState < 0 ) Thread . interrupted ( ) ; } } return stat ; }
possibly blocks worker w waiting for signal , or returns negative status if the worker should terminate . may return without status change if multiple stale unparks and / or interrupts occur .
