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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user