a-foundation-benchmark/src/main/java/com/ajjpj/afoundation/concurrent/jdk/j9new/ForkJoinPool.java
private int awaitRunStateLock() {
        Object lock;
        boolean wasInterrupted = false;
        for (int spins = SPINS, r = 0, rs, ns;;) {
            if (((rs = runState) & RSLOCK) == 0) {
                if (U.compareAndSwapInt(this, RUNSTATE, rs, ns = rs | RSLOCK)) {
                    if (wasInterrupted) {
                        try {
                            Thread.currentThread().interrupt();
                        } catch (SecurityException ignore) {
                        }
                    }
                    return ns;
                }
            }
            else if (r == 0)
                r = ThreadLocalRandomHelper.nextSecondarySeed ();
            else if (spins > 0) {
                r ^= r << 6; r ^= r >>> 21; r ^= r << 7; // xorshift
                if (r >= 0)
                    --spins;
            }
            else if ((rs & STARTED) == 0 || (lock = stealCounter) == null)
                Thread.yield();   // initialization race
            else if (U.compareAndSwapInt(this, RUNSTATE, rs, rs | RSIGNAL)) {
                synchronized (lock) {
                    if ((runState & RSIGNAL) != 0) {
                        try {
                            lock.wait();
                        } catch (InterruptedException ie) {
                            if (!(Thread.currentThread() instanceof
                                    ForkJoinWorkerThread))
                                wasInterrupted = true;
                        }
                    }
                    else
                        lock.notifyAll();
                }
            }
        }
    }
private int awaitRunStateLock() {
        Object lock;
        boolean wasInterrupted = false;
        for (int spins = SPINS, r = 0, rs, ns;;) {
            if (((rs = runState) & RSLOCK) == 0) {
                if (U.compareAndSwapInt(this, RUNSTATE, rs, ns = rs | RSLOCK)) {
                    if (wasInterrupted) {
                        try {
                            Thread.currentThread().interrupt();
                        } catch (SecurityException ignore) {
                        }
                    }
                    return ns;
                }
            }
            else if (r == 0)
                r = ThreadLocalRandomHelper.nextSecondarySeed ();
            else if (spins > 0) {
                r ^= r << 6; r ^= r >>> 21; r ^= r << 7; // xorshift
                if (r >= 0)
                    --spins;
            }
            else if ((rs & STARTED) == 0 || (lock = stealCounter) == null)
                Thread.yield();   // initialization race
            else if (U.compareAndSwapInt(this, RUNSTATE, rs, rs | RSIGNAL)) {
                synchronized (lock) {
                    if ((runState & RSIGNAL) != 0) {
                        try {
                            lock.wait();
                        } catch (InterruptedException ie) {
                            if (!(Thread.currentThread() instanceof
                                    ForkJoinWorkerThread))
                                wasInterrupted = true;
                        }
                    }
                    else
                        lock.notifyAll();
                }
            }
        }
    }
private int awaitRunStateLock ( ) { Object lock ; boolean wasInterrupted = false ; for ( int spins = SPINS , r = 0 , rs , ns ; ; ) { if ( ( ( rs = runState ) & RSLOCK ) == 0 ) { if ( U . compareAndSwapInt ( this , RUNSTATE , rs , ns = rs | RSLOCK ) ) { if ( wasInterrupted ) { try { Thread . currentThread ( ) . interrupt ( ) ; } catch ( SecurityException ignore ) { } } return ns ; } } else if ( r == 0 ) r = ThreadLocalRandomHelper . nextSecondarySeed ( ) ; else if ( spins > 0 ) { r ^= r << 6 ; r ^= r >>> 21 ; r ^= r << 7 ; // xorshift if ( r >= 0 ) -- spins ; } else if ( ( rs & STARTED ) == 0 || ( lock = stealCounter ) == null ) Thread . yield ( ) ; // initialization race else if ( U . compareAndSwapInt ( this , RUNSTATE , rs , rs | RSIGNAL ) ) { synchronized ( lock ) { if ( ( runState & RSIGNAL ) != 0 ) { try { lock . wait ( ) ; } catch ( InterruptedException ie ) { if ( ! ( Thread . currentThread ( ) instanceof ForkJoinWorkerThread ) ) wasInterrupted = true ; } } else lock . notifyAll ( ) ; } } } }
Spins and/or blocks until runstate lock is available.  See
above for explanation.
Spins and / or blocks until runstate lock is available . See above for explanation .