diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-09-05 10:57:30 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-09-05 10:57:30 +0300 |
commit | 05721cd00ad164822e270500237fc9457d969812 (patch) | |
tree | 18663dc4b4726b17b31e5f75dddf680f0f3da7db /source/blender/blenlib/intern/task.c | |
parent | 17baa43e5919521aedaa9e606b1a64d44e1ee387 (diff) |
Mesh Batch Cache: Fix threading issue
I believed the crash I experienced happened because:
1. The `extract_pos_nor_init` function is called.
2. Tasks are added to the task pool for `extract_pos_nor`.
3. The tasks begin to be executed while more tasks are added.
4. In some rare cases, all existing tasks are finished, but not all have been added yet.
5. This let the task-counter go down to zero.
6. This triggered a call to `extract_pos_nor_finish`.
7. Then more tasks are added and in the end `extract_pos_nor_finish` is called again.
A solution is to use a task pool that is suspended when created.
Unfortunately, there was an outdated comment, that was probably the root cause of the issue.
Reviewers: fclem, sergey
Differential Revision: https://developer.blender.org/D5680
Diffstat (limited to 'source/blender/blenlib/intern/task.c')
-rw-r--r-- | source/blender/blenlib/intern/task.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index 034a6d4017e..7c5ccd7aeb6 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -732,9 +732,7 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler, } /** - * Create a normal task pool. - * This means that in single-threaded context, it will not be executed at all until you call - * \a BLI_task_pool_work_and_wait() on it. + * Create a normal task pool. Tasks will be executed as soon as they are added. */ TaskPool *BLI_task_pool_create(TaskScheduler *scheduler, void *userdata) { |