More race conditions.
This commit is contained in:
parent
061169633d
commit
718764e533
3 changed files with 8 additions and 12 deletions
|
|
@ -68,9 +68,13 @@ namespace TShockAPI
|
|||
Directory.CreateDirectory(worldpath);
|
||||
|
||||
Tools.Broadcast("Server map saving, potential lag spike");
|
||||
Console.WriteLine("Backing up world...");
|
||||
Thread SaveWorld = new Thread(Tools.SaveWorld);
|
||||
SaveWorld.Start();
|
||||
|
||||
while (SaveWorld.ThreadState == ThreadState.Running)
|
||||
Thread.Sleep(50);
|
||||
|
||||
Main.worldPathName = worldname;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ namespace TShockAPI
|
|||
|
||||
public static IDbConnection Sql;
|
||||
|
||||
public static bool WorldSaving = false;
|
||||
|
||||
public override Version Version
|
||||
{
|
||||
get { return VersionNum; }
|
||||
|
|
@ -540,15 +538,10 @@ namespace TShockAPI
|
|||
|
||||
private void OnSaveWorld(bool resettime, HandledEventArgs e)
|
||||
{
|
||||
if (!WorldSaving)
|
||||
{
|
||||
WorldSaving = true;
|
||||
Tools.Broadcast("Saving world, might lag.", Color.Red);
|
||||
Thread SaveWorld = new Thread(Tools.SaveWorld);
|
||||
SaveWorld.Start();
|
||||
WorldSaving = false;
|
||||
e.Handled = true;
|
||||
}
|
||||
Tools.Broadcast("Saving world, might lag.", Color.Red);
|
||||
Thread SaveWorld = new Thread(Tools.SaveWorld);
|
||||
SaveWorld.Start();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ namespace TShockAPI
|
|||
WorldGen.RealsaveWorld();
|
||||
|
||||
Broadcast("World saved.", Color.Yellow);
|
||||
Console.WriteLine("World saved.");
|
||||
Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue