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 <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2023-10-03 22:59:23 -07:00
parent 8997ffa030
commit 5e27f084e9
No known key found for this signature in database

View file

@ -31,6 +31,7 @@ static std::map<std::string, Cached_Metadata> Cache_List;
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