1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Move previousContext assign within lock to make things look safer

Not an actual requirement, but no harm.
This commit is contained in:
Dean Herbert 2021-07-05 10:49:55 +09:00
parent 3291f15dcc
commit f510ef9153

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Development;
@ -166,11 +167,15 @@ namespace osu.Game.Database
private void flushContexts()
{
Logger.Log(@"Flushing realm contexts...", LoggingTarget.Database);
Debug.Assert(blockingLock.CurrentCount == 0);
var previousContext = context;
Realm previousContext;
lock (updateContextLock)
{
previousContext = context;
context = null;
}
// wait for all threaded usages to finish
while (active_usages.Value > 0)