diff --git a/MCGalaxy/Commands/building/CmdImageprint.cs b/MCGalaxy/Commands/building/CmdImageprint.cs index ae270d56f..e6baf01b6 100644 --- a/MCGalaxy/Commands/building/CmdImageprint.cs +++ b/MCGalaxy/Commands/building/CmdImageprint.cs @@ -107,6 +107,7 @@ bool DoImage(Player p, Vec3S32[] m, object state, BlockID block) { Thread thread; Server.StartThread(out thread, "ImagePrint", () => DoDrawImage(p, m, (DrawArgs)state)); + thread.IsBackground = true; return false; } diff --git a/MCGalaxy/Games/RoundsGame/RoundsGame.cs b/MCGalaxy/Games/RoundsGame/RoundsGame.cs index 423e5f138..c9541da27 100644 --- a/MCGalaxy/Games/RoundsGame/RoundsGame.cs +++ b/MCGalaxy/Games/RoundsGame/RoundsGame.cs @@ -84,6 +84,7 @@ public virtual void Start(Player p, string map, int rounds) { Thread thread; Server.StartThread(out thread, "Game_ " + GameName, RunGame); + thread.IsBackground = true; } /// Attempts to auto start this game with infinite rounds. diff --git a/MCGalaxy/Levels/Level.Physics.cs b/MCGalaxy/Levels/Level.Physics.cs index f60f3ade6..e0ffb294e 100644 --- a/MCGalaxy/Levels/Level.Physics.cs +++ b/MCGalaxy/Levels/Level.Physics.cs @@ -58,6 +58,7 @@ public void StartPhysics() { Server.StartThread(out physThread, "Physics_" + name, PhysicsLoop); + physThread.IsBackground = true; physThreadStarted = true; } } diff --git a/MCGalaxy/Modules/Relay/RelayBot.cs b/MCGalaxy/Modules/Relay/RelayBot.cs index 217481380..853d8e20e 100644 --- a/MCGalaxy/Modules/Relay/RelayBot.cs +++ b/MCGalaxy/Modules/Relay/RelayBot.cs @@ -203,6 +203,7 @@ void IOThread() { void RunAsync() { Server.StartThread(out worker, RelayName + "_RelayBot", IOThread); + worker.IsBackground = true; } protected abstract void DoConnect(); diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs index cb3e8c1c4..190e21f2c 100644 --- a/MCGalaxy/Player/Player.Handlers.cs +++ b/MCGalaxy/Player/Player.Handlers.cs @@ -558,6 +558,7 @@ public void HandleCommand(string cmd, string args, CommandData data) { Thread thread; Server.StartThread(out thread, "CMD_ " + cmd, callback); + thread.IsBackground = true; } catch (Exception e) { Logger.LogError(e); Message("&WCommand failed"); @@ -584,6 +585,7 @@ public void HandleCommands(List cmds, CommandData data) { Thread thread; Server.StartThread(out thread, "CMDS_", () => UseCommands(commands, messages, data)); + thread.IsBackground = true; } catch (Exception e) { Logger.LogError(e); Message("&WCommand failed."); diff --git a/MCGalaxy/Server/Server.cs b/MCGalaxy/Server/Server.cs index 981e2f0f3..4014fae61 100644 --- a/MCGalaxy/Server/Server.cs +++ b/MCGalaxy/Server/Server.cs @@ -344,7 +344,6 @@ public static void DoGC() { public static void StartThread(out Thread thread, string name, ThreadStart threadFunc) { thread = new Thread(threadFunc); - thread.IsBackground = true; try { thread.Name = name; } catch { } thread.Start(); } diff --git a/MCGalaxy/util/Threading/AsyncWorker.cs b/MCGalaxy/util/Threading/AsyncWorker.cs index d0cddd788..fc35bf3ab 100644 --- a/MCGalaxy/util/Threading/AsyncWorker.cs +++ b/MCGalaxy/util/Threading/AsyncWorker.cs @@ -68,6 +68,7 @@ void WakeupWorker() { public void RunAsync() { Thread worker; Server.StartThread(out worker, ThreadName, SendLoop); + worker.IsBackground = true; } public void StopAsync() { diff --git a/MCGalaxy/util/UIHelpers.cs b/MCGalaxy/util/UIHelpers.cs index 21f116f56..c6f4e6ae8 100644 --- a/MCGalaxy/util/UIHelpers.cs +++ b/MCGalaxy/util/UIHelpers.cs @@ -83,6 +83,7 @@ public static void HandleCommand(string text) { Logger.Log(LogType.CommandUsage, "(console): FAILED COMMAND"); } }); + thread.IsBackground = true; } public static string Format(string message) {