diff options
author | Jacques Lucke <jacques@blender.org> | 2021-06-08 10:37:45 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-06-08 11:39:33 +0300 |
commit | ed1fc9d96bbac2ac3d4282400a9717e19e84211d (patch) | |
tree | 94892b3c1dd4a7be31124afa5084af4e165a97b6 /source/blender/blenlib/intern/task_iterator.c | |
parent | 496045fc30f72be8d2ca32394ed233266f043152 (diff) |
BLI: support disabling task isolation in task pool
Under some circumstances using task isolation can cause deadlocks.
Previously, our task pool implementation would run all tasks in an
isolated region. Now using task isolation is optional and can be
turned on/off for individual task pools.
Task pools that spawn new tasks recursively should never enable
task isolation. There is a new check that finds these cases at runtime.
Right now this check is disabled, so that this commit is a pure refactor.
It will be enabled in an upcoming commit.
This fixes T88598.
Differential Revision: https://developer.blender.org/D11415
Diffstat (limited to 'source/blender/blenlib/intern/task_iterator.c')
-rw-r--r-- | source/blender/blenlib/intern/task_iterator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/task_iterator.c b/source/blender/blenlib/intern/task_iterator.c index 38271e5823f..85cd9718ed4 100644 --- a/source/blender/blenlib/intern/task_iterator.c +++ b/source/blender/blenlib/intern/task_iterator.c @@ -223,7 +223,7 @@ static void task_parallel_iterator_do(const TaskParallelSettings *settings, void *userdata_chunk_array = NULL; const bool use_userdata_chunk = (userdata_chunk_size != 0) && (userdata_chunk != NULL); - TaskPool *task_pool = BLI_task_pool_create(state, TASK_PRIORITY_HIGH); + TaskPool *task_pool = BLI_task_pool_create(state, TASK_PRIORITY_HIGH, TASK_ISOLATION_ON); if (use_userdata_chunk) { userdata_chunk_array = MALLOCA(userdata_chunk_size * num_tasks); @@ -398,7 +398,7 @@ void BLI_task_parallel_mempool(BLI_mempool *mempool, return; } - task_pool = BLI_task_pool_create(&state, TASK_PRIORITY_HIGH); + task_pool = BLI_task_pool_create(&state, TASK_PRIORITY_HIGH, TASK_ISOLATION_ON); num_threads = BLI_task_scheduler_num_threads(); /* The idea here is to prevent creating task for each of the loop iterations |