private final void contendedLock ( ) { boolean waiting = false ; for ( int s ; ; ) { if ( ( ( s = lockState ) & ~ WAITER ) == 0 ) { if ( U . compareAndSwapInt ( this , LOCKSTATE , s , WRITER ) ) { if ( waiting ) waiter = null ; return ; } } else if ( ( s & WAITER ) == 0 ) { if ( U . compareAndSwapInt ( this , LOCKSTATE , s , s | WAITER ) ) { waiting = true ; waiter = Thread . currentThread ( ) ; } } else if ( waiting ) LockSupport . park ( this ) ; } }
Possibly blocks awaiting root lock .