public final void lockForWrite ( L locker ) { if ( ! tryLockForWrite ( locker ) ) { Result upgradeResult = lockForUpgrade_ ( locker ) ; if ( ! tryLockForWrite ( locker ) ) { lockForWriteQueued ( locker , addWriteWaiter ( ) ) ; } if ( upgradeResult == Result . ACQUIRED ) { // clear upgrade state bit to indicate automatic upgrade while ( ! clearUpgradeLock ( mState ) ) { } } else { // undo automatic upgrade count increment mUpgradeCount -- ; } } }
Acquire an exclusive write lock possibly blocking indefinitely .