From 07e3612e4da862e96e6f247dca99a1865b5e5472 Mon Sep 17 00:00:00 2001 From: rogerman Date: Tue, 23 Aug 2016 23:17:10 +0000 Subject: [PATCH] task.cpp: - When shutting down, ensure that the existing task is finished if its running before continuing with the shutdown process. - Explicitly declare thunkTaskProc() as static. --- desmume/src/utils/task.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desmume/src/utils/task.cpp b/desmume/src/utils/task.cpp index 999679526..447958992 100644 --- a/desmume/src/utils/task.cpp +++ b/desmume/src/utils/task.cpp @@ -51,6 +51,8 @@ int getOnlineCores (void) #endif } +static void thunkTaskProc(void *arg); + class Task::Impl { private: sthread_t* thread; @@ -77,7 +79,7 @@ public: bool started; }; -void thunkTaskProc(void *arg) +static void thunkTaskProc(void *arg) { Task::Impl *ctx = (Task::Impl *)arg; ctx->taskProc(); @@ -153,6 +155,7 @@ void Task::Impl::shutdown() { if(!started) return; + finish(); // Ensure that any previous tasks are finished before calling killTask(). execute(killTask,this); finish();