From 4c20271dc7dc7dae50fd6d1e9cdb0ebc51769b65 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 4 Mar 2019 02:47:56 +0100 Subject: [PATCH] ticker: fix a crash upon exit on Windows. We need to ensure the inter-thread messaging queues are empty (more specifically, not locked) before destroying them. The best way to ensure that is to explicitly wait for thread termination. --- src/engine/ticker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/ticker.cpp b/src/engine/ticker.cpp index d1982c46..cea13b5a 100644 --- a/src/engine/ticker.cpp +++ b/src/engine/ticker.cpp @@ -49,6 +49,8 @@ public: #if LOL_FEATURE_THREADS gametick.push(0); disktick.push(0); + gamethread.release(); + diskthread.release(); #endif } @@ -82,7 +84,6 @@ private: void GameThreadMain(); void DrawThreadMain(); /* unused for now */ void DiskThreadMain(); - thread *drawthread; std::unique_ptr gamethread, diskthread; queue gametick, drawtick, disktick; #endif