Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-05-09 18:01:40 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-05-09 18:17:20 +0300
commit633fee72d5cb4c1f3136781561a72deb301a44d7 (patch)
treed674a0aa80bbad72bea9a5dca9ea849ebb508d4b /source/blender/blenlib/intern/task_pool.cc
parent9be28095cba4fdff77626f54d61afb0acdd2f9dd (diff)
Fix T76427: edit mesh undo hanges when building without TBB
Background task pools would not restart threads if reused multiple times, thanks to Jeroen for identifying the cause of this problem. Differential Revision: https://developer.blender.org/D7659
Diffstat (limited to 'source/blender/blenlib/intern/task_pool.cc')
-rw-r--r--source/blender/blenlib/intern/task_pool.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc
index d8e90af551a..c4d60673492 100644
--- a/source/blender/blenlib/intern/task_pool.cc
+++ b/source/blender/blenlib/intern/task_pool.cc
@@ -305,7 +305,6 @@ static void background_task_pool_create(TaskPool *pool)
{
pool->background_queue = BLI_thread_queue_init();
BLI_threadpool_init(&pool->background_threads, background_task_run, 1);
- BLI_threadpool_insert(&pool->background_threads, pool);
}
static void background_task_pool_run(TaskPool *pool, Task &&task)
@@ -313,6 +312,10 @@ static void background_task_pool_run(TaskPool *pool, Task &&task)
Task *task_mem = (Task *)MEM_mallocN(sizeof(Task), __func__);
new (task_mem) Task(std::move(task));
BLI_thread_queue_push(pool->background_queue, task_mem);
+
+ if (BLI_available_threads(&pool->background_threads)) {
+ BLI_threadpool_insert(&pool->background_threads, pool);
+ }
}
static void background_task_pool_work_and_wait(TaskPool *pool)
@@ -321,7 +324,7 @@ static void background_task_pool_work_and_wait(TaskPool *pool)
* left, and wait for tasks and thread to finish. */
BLI_thread_queue_nowait(pool->background_queue);
BLI_thread_queue_wait_finish(pool->background_queue);
- BLI_threadpool_remove(&pool->background_threads, pool);
+ BLI_threadpool_clear(&pool->background_threads);
}
static void background_task_pool_cancel(TaskPool *pool)