From 5e27f084e9e4c04fb4534db58aa774cc4d29a3f3 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 3 Oct 2023 22:59:23 -0700 Subject: [PATCH] Add a cache shutdown guard This appears to maybe be necessary as the prior join call doesn't seem to be doing what it should. Signed-off-by: Christopher Snowhill --- Audio/PluginController.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Audio/PluginController.mm b/Audio/PluginController.mm index 55e694fb7..98d081c03 100644 --- a/Audio/PluginController.mm +++ b/Audio/PluginController.mm @@ -31,6 +31,7 @@ static RedundantPlaylistDataStore *Cache_Data_Store = nil; static bool Cache_Running = false; +static bool Cache_Stopped = false; static std::thread *Cache_Thread = NULL; @@ -44,6 +45,8 @@ static void cache_init() { static void cache_deinit() { Cache_Running = false; Cache_Thread->join(); + while(!Cache_Stopped) + usleep(500); delete Cache_Thread; Cache_Data_Store = nil; } @@ -135,6 +138,8 @@ static void cache_run() { std::this_thread::sleep_for(dura); } + + Cache_Stopped = true; } @implementation PluginController