/** * Called with exclusive latch held, which is retained. * * @param latch briefly released and re-acquired for deleting a ghost * @throws IllegalStateException if lock not held */ void unlockToUpgradable(_LockOwner locker, Latch latch) { if (mOwner != locker) { String message = "Exclusive or upgradable lock not held"; if (mLockCount == 0 || !isSharedLockOwner(locker)) { message = "_Lock not held"; } throw new IllegalStateException(message); } if (mLockCount != ~0) { // Already upgradable. return; } deleteGhost(latch); mLockCount = 0x80000000; LatchCondition queueSX = mQueueSX; if (queueSX != null) { queueSX.signalShared(); } }
deleteGhost(latch); mOwner = null; LatchCondition queueU = mQueueU;
/** * Called with exclusive latch held, which is released unless an exception is thrown. * * @param latch briefly released and re-acquired for deleting a ghost * @throws IllegalStateException if lock not held */ void unlockToUpgradable(_LockOwner locker, Latch latch) { if (mOwner != locker) { if (isClosed(locker)) { latch.releaseExclusive(); return; } String message = "Exclusive or upgradable lock not held"; if (mLockCount == 0 || !isSharedLockOwner(locker)) { message = "Lock not held"; } throw new IllegalStateException(message); } if (mLockCount != ~0) { // Already upgradable. latch.releaseExclusive(); return; } deleteGhost(latch); mLockCount = 0x80000000; LatchCondition queueSX = mQueueSX; if (queueSX == null || !queueSX.signalSharedRelease(latch)) { latch.releaseExclusive(); } }
/** * Called with exclusive latch held, which is released unless an exception is thrown. * * @param latch briefly released and re-acquired for deleting a ghost * @throws IllegalStateException if lock not held */ void unlockToUpgradable(_LockOwner locker, Latch latch) { if (mOwner != locker) { if (isClosed(locker)) { latch.releaseExclusive(); return; } String message = "Exclusive or upgradable lock not held"; if (mLockCount == 0 || !isSharedLockOwner(locker)) { message = "Lock not held"; } throw new IllegalStateException(message); } if (mLockCount != ~0) { // Already upgradable. latch.releaseExclusive(); return; } deleteGhost(latch); mLockCount = 0x80000000; LatchCondition queueSX = mQueueSX; if (queueSX == null || !queueSX.signalSharedRelease(latch)) { latch.releaseExclusive(); } }
deleteGhost(latch); mOwner = null; LatchCondition queueU = mQueueU;
deleteGhost(latch);