diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-03 22:55:18 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-04 14:08:50 +0300 |
commit | 01581d4a1eb595f2bb49d4b87aebfa8bd67ceb38 (patch) | |
tree | 851b669f25bf9f56a3e57eda9090fa26212e07ac /source/blender/blenlib/BLI_task.h | |
parent | c86e828eee8b7e7e0cde4fa211991b6ebac1ff0f (diff) |
BLI_task: fix queue in work_and_wait, and support resetting.
To make the pool more usable for running multiple stages of tasks,
fix local queue handling in BLI_task_pool_work_and_wait.
Specifically, after the wait loop the local queue should be empty,
or the wait part of the function contract isn't fulfilled. Instead,
check and run any tasks in queue before the wait loop.
Also, add a new function that resets the suspended state of the pool.
Diffstat (limited to 'source/blender/blenlib/BLI_task.h')
-rw-r--r-- | source/blender/blenlib/BLI_task.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index 9194caca007..8300f6242db 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -98,6 +98,8 @@ void BLI_task_pool_push_from_thread(TaskPool *pool, TaskRunFunction run, /* work and wait until all tasks are done */ void BLI_task_pool_work_and_wait(TaskPool *pool); +/* work and wait until all tasks are done, then reset to the initial suspended state */ +void BLI_task_pool_work_wait_and_reset(TaskPool *pool); /* cancel all tasks, keep worker threads running */ void BLI_task_pool_cancel(TaskPool *pool); |