Use Thread.IsAlive property

This commit is contained in:
John Gross
2017-08-21 20:39:54 -07:00
parent e9476a59e8
commit b5f73a99cc

View File

@@ -183,7 +183,7 @@ namespace Torch.Server
if (!mre.WaitOne(TimeSpan.FromSeconds(Instance.Config.TickTimeout))) if (!mre.WaitOne(TimeSpan.FromSeconds(Instance.Config.TickTimeout)))
{ {
var mainThread = MySandboxGame.Static.UpdateThread; var mainThread = MySandboxGame.Static.UpdateThread;
if (mainThread.ThreadState == System.Threading.ThreadState.Running) if (mainThread.IsAlive)
mainThread.Suspend(); mainThread.Suspend();
var stackTrace = new StackTrace(mainThread, true); var stackTrace = new StackTrace(mainThread, true);
throw new TimeoutException($"Server watchdog detected that the server was frozen for at least {((TorchServer)state).Config.TickTimeout} seconds.\n{stackTrace}"); throw new TimeoutException($"Server watchdog detected that the server was frozen for at least {((TorchServer)state).Config.TickTimeout} seconds.\n{stackTrace}");