Skip to content

Commit

Permalink
Add a cache shutdown guard
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kode54 committed Oct 4, 2023
1 parent 8997ffa commit 5e27f08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Audio/PluginController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down Expand Up @@ -135,6 +138,8 @@ static void cache_run() {

std::this_thread::sleep_for(dura);
}

Cache_Stopped = true;
}

@implementation PluginController
Expand Down

0 comments on commit 5e27f08

Please sign in to comment.