mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Allow BlockAllOperations
to be called from a non-update thread if update has never run
This commit is contained in:
@ -366,17 +366,17 @@ namespace osu.Game.Database
|
|||||||
if (isDisposed)
|
if (isDisposed)
|
||||||
throw new ObjectDisposedException(nameof(RealmContextFactory));
|
throw new ObjectDisposedException(nameof(RealmContextFactory));
|
||||||
|
|
||||||
if (!ThreadSafety.IsUpdateThread)
|
|
||||||
throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread.");
|
|
||||||
|
|
||||||
Logger.Log(@"Blocking realm operations.", LoggingTarget.Database);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
contextCreationLock.Wait();
|
contextCreationLock.Wait();
|
||||||
|
|
||||||
lock (contextLock)
|
lock (contextLock)
|
||||||
{
|
{
|
||||||
|
if (!ThreadSafety.IsUpdateThread && context != null)
|
||||||
|
throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread.");
|
||||||
|
|
||||||
|
Logger.Log(@"Blocking realm operations.", LoggingTarget.Database);
|
||||||
|
|
||||||
context?.Dispose();
|
context?.Dispose();
|
||||||
context = null;
|
context = null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user