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:
parent
8997ffa030
commit
5e27f084e9
1 changed files with 5 additions and 0 deletions
|
@ -31,6 +31,7 @@ static std::map<std::string, Cached_Metadata> Cache_List;
|
||||||
static RedundantPlaylistDataStore *Cache_Data_Store = nil;
|
static RedundantPlaylistDataStore *Cache_Data_Store = nil;
|
||||||
|
|
||||||
static bool Cache_Running = false;
|
static bool Cache_Running = false;
|
||||||
|
static bool Cache_Stopped = false;
|
||||||
|
|
||||||
static std::thread *Cache_Thread = NULL;
|
static std::thread *Cache_Thread = NULL;
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ static void cache_init() {
|
||||||
static void cache_deinit() {
|
static void cache_deinit() {
|
||||||
Cache_Running = false;
|
Cache_Running = false;
|
||||||
Cache_Thread->join();
|
Cache_Thread->join();
|
||||||
|
while(!Cache_Stopped)
|
||||||
|
usleep(500);
|
||||||
delete Cache_Thread;
|
delete Cache_Thread;
|
||||||
Cache_Data_Store = nil;
|
Cache_Data_Store = nil;
|
||||||
}
|
}
|
||||||
|
@ -135,6 +138,8 @@ static void cache_run() {
|
||||||
|
|
||||||
std::this_thread::sleep_for(dura);
|
std::this_thread::sleep_for(dura);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cache_Stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation PluginController
|
@implementation PluginController
|
||||||
|
|
Loading…
Reference in a new issue