Skip to content

Commit

Permalink
Remove unnecessary underflow check in Forsetti
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvest committed Mar 8, 2016
1 parent 91b55f4 commit f6784c4
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -708,22 +708,15 @@ private boolean releaseLocalLock( ResourceType type, long resourceId, PrimitiveL

if ( lockCount > 1 )
{
localLocks.put( resourceId, decrementExactToZero( lockCount ) );
localLocks.put( resourceId, lockCount - 1 );
return true;
}
return false;
}

private static int decrementExactToZero( int value )
{
if ( value == 0 )
{
throw new ArithmeticException();
}
return value - 1;
}

/** Attempt to upgrade a share lock to an exclusive lock, grabbing the share lock if we don't hold it. */
/**
* Attempt to upgrade a share lock to an exclusive lock, grabbing the share lock if we don't hold it.
**/
private boolean tryUpgradeSharedToExclusive( ResourceType resourceType,
ConcurrentMap<Long,ForsetiLockManager.Lock> lockMap,
long resourceId, SharedLock sharedLock )
Expand Down

0 comments on commit f6784c4

Please sign in to comment.