Added missing mutex lock around do_exit assignment in task scheduler

Without this lock it's possible that thread_wait_pop will stuck
at the point where it await for new task in the queue but in
fact exit was requested already.

This ended up in deadlock in some circumstances. Really random
because it totally depends on timings.
This commit is contained in:
Sergey Sharybin
2013-07-02 19:23:09 +00:00
parent a03437cb1a
commit bae2a2c3b2

View File

@@ -186,8 +186,10 @@ void BLI_task_scheduler_free(TaskScheduler *scheduler)
Task *task;
/* stop all waiting threads */
BLI_mutex_lock(&scheduler->queue_mutex);
scheduler->do_exit = true;
BLI_condition_notify_all(&scheduler->queue_cond);
BLI_mutex_unlock(&scheduler->queue_mutex);
/* delete threads */
if(scheduler->threads) {