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.
This commit is contained in:
rogerman 2016-08-23 23:17:10 +00:00
parent a1a6c47aac
commit 07e3612e4d
1 changed files with 4 additions and 1 deletions

View File

@ -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();