private void advanceRunState ( int targetState ) { // assert targetState == SHUTDOWN || targetState == STOP; for ( ; ; ) { int c = ctl . get ( ) ; if ( runStateAtLeast ( c , targetState ) || ctl . compareAndSet ( c , ctlOf ( targetState , workerCountOf ( c ) ) ) ) break ; } }
Transitions runState to given target or leaves it alone if already at least the given target .