From cf92e8067227777ac6832856cd63ce319b3d8fe0 Mon Sep 17 00:00:00 2001 From: Baptiste Marie Date: Sun, 4 Aug 2024 15:40:57 +0200 Subject: [PATCH] `GameLoop.Exit`: Don't call `Thread.Join` on ourselves --- GameServer/managers/GameLoopManager/GameLoop.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GameServer/managers/GameLoopManager/GameLoop.cs b/GameServer/managers/GameLoopManager/GameLoop.cs index 5298aa3db1..4521255f14 100644 --- a/GameServer/managers/GameLoopManager/GameLoop.cs +++ b/GameServer/managers/GameLoopManager/GameLoop.cs @@ -61,8 +61,12 @@ public static void Exit() if (_gameLoopThread == null) return; - _gameLoopThread.Interrupt(); - _gameLoopThread.Join(); + if (Thread.CurrentThread != _gameLoopThread) + { + _gameLoopThread.Interrupt(); + _gameLoopThread.Join(); + } + _gameLoopThread = null; _busyWaitThresholdThread.Interrupt(); _busyWaitThresholdThread.Join();