Skip to content

Commit

Permalink
Merge pull request #2280 from mathis1337/master
Browse files Browse the repository at this point in the history
Hi guys, thanks for this PR. Sorry for long delay. Will be publish today in new release
  • Loading branch information
mbdavid authored Jul 20, 2023
2 parents 967c413 + 15b3f6b commit d6038bf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions LiteDB/Engine/Services/LockService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,16 @@ public void ExitTransaction()
{
// if current thread are in reserved mode, do not exit transaction (will be exit from ExitExclusive)
if (_transaction.IsWriteLockHeld) return;

_transaction.ExitReadLock();

//This can be called when a lock has either been released by the slim or somewhere else therefore there is no lock to release from ExitReadLock()
if (_transaction.IsReadLockHeld)
{
try
{
_transaction.ExitReadLock();
}
catch { }
}
}

/// <summary>
Expand Down Expand Up @@ -148,4 +156,4 @@ public void Dispose()
}
}
}
}
}

0 comments on commit d6038bf

Please sign in to comment.