mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Remove Dispose()
special case and add explicit exception to make debugging issues non-deadlock
This commit is contained in:
@ -97,6 +97,9 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (IsDisposed)
|
||||||
|
throw new InvalidOperationException(@"Attempted to retrieve a context after the factor has already been disposed.");
|
||||||
|
|
||||||
blockingLock.Wait();
|
blockingLock.Wait();
|
||||||
|
|
||||||
contexts_created.Value++;
|
contexts_created.Value++;
|
||||||
@ -128,11 +131,8 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
// In the standard case, operations will already be blocked by the Update thread "pausing" from GameHost exit.
|
// intentionally block all operations indefinitely. this ensures that nothing can start consuming a new context after disposal.
|
||||||
// This avoids waiting (forever) on an already entered semaphore.
|
BlockAllOperations();
|
||||||
if (context != null || active_usages.Value > 0)
|
|
||||||
BlockAllOperations();
|
|
||||||
|
|
||||||
blockingLock?.Dispose();
|
blockingLock?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user