fix: Fixes serialization threading, moves world save to end of loop, and eliminates Parallel.ForEach. (#1530)
This commit is contained in:
parent
e18115dd94
commit
1f0acddc46
12 changed files with 228 additions and 58 deletions
|
|
@ -36,6 +36,7 @@ public static class Core
|
|||
{
|
||||
private static readonly ILogger logger = LogFactory.GetLogger(typeof(Core));
|
||||
|
||||
private static bool _performSnapshot;
|
||||
private static bool _crashed;
|
||||
private static string _baseDirectory;
|
||||
|
||||
|
|
@ -556,6 +557,12 @@ public static class Core
|
|||
|
||||
Timer.CheckTimerPool(); // Check for pool depletion so we can async refill it.
|
||||
|
||||
if (_performSnapshot)
|
||||
{
|
||||
// Return value is the offset that can be used to fix timers that should drift
|
||||
World.Snapshot();
|
||||
}
|
||||
|
||||
_tickCount = 0;
|
||||
_now = DateTime.MinValue;
|
||||
|
||||
|
|
@ -578,8 +585,14 @@ public static class Core
|
|||
{
|
||||
CurrentDomain_UnhandledException(null, new UnhandledExceptionEventArgs(e, true));
|
||||
}
|
||||
finally
|
||||
{
|
||||
World.SleepSerializationThreads();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RequestSnapshot() => _performSnapshot = true;
|
||||
|
||||
public static void VerifySerialization()
|
||||
{
|
||||
_itemCount = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue