private void doAcquireShared ( long arg ) { final Node node = addWaiter ( Node . SHARED ) ; try { boolean interrupted = false ; for ( ; ; ) { final Node p = node . predecessor ( ) ; if ( p == head ) { long r = tryAcquireShared ( arg ) ; if ( r >= 0 ) { setHeadAndPropagate ( node , r ) ; p . next = null ; // help GC if ( interrupted ) selfInterrupt ( ) ; return ; } } if ( shouldParkAfterFailedAcquire ( p , node ) && parkAndCheckInterrupt ( ) ) interrupted = true ; } } catch ( Throwable t ) { cancelAcquire ( node ) ; throw t ; } }
Acquires in shared uninterruptible mode .