|
Blender
V2.93
|
#include <cstdlib>#include <memory>#include <utility>#include "MEM_guardedalloc.h"#include "DNA_listBase.h"#include "BLI_math.h"#include "BLI_mempool.h"#include "BLI_task.h"#include "BLI_threads.h"Go to the source code of this file.
Classes | |
| class | Task |
| class | TaskPool |
Enumerations | |
| enum | TaskPoolType { TASK_POOL_TBB , TASK_POOL_TBB_SUSPENDED , TASK_POOL_NO_THREADS , TASK_POOL_BACKGROUND , TASK_POOL_BACKGROUND_SERIAL } |
Task pool to run tasks in parallel.
Definition in file task_pool.cc.
| enum TaskPoolType |
| Enumerator | |
|---|---|
| TASK_POOL_TBB | |
| TASK_POOL_TBB_SUSPENDED | |
| TASK_POOL_NO_THREADS | |
| TASK_POOL_BACKGROUND | |
| TASK_POOL_BACKGROUND_SERIAL | |
Definition at line 155 of file task_pool.cc.
|
static |
Definition at line 337 of file task_pool.cc.
References TaskPool::background_is_canceling, TaskPool::background_queue, TaskPool::background_threads, BLI_thread_queue_nowait(), BLI_thread_queue_pop(), BLI_threadpool_remove(), MEM_freeN, blender::compositor::pool, and blender::compositor::task.
Referenced by BLI_task_pool_cancel().
|
static |
Definition at line 353 of file task_pool.cc.
References TaskPool::background_is_canceling, and blender::compositor::pool.
Referenced by BLI_task_pool_current_canceled().
|
static |
Definition at line 311 of file task_pool.cc.
References TaskPool::background_queue, background_task_run(), TaskPool::background_threads, BLI_thread_queue_init(), BLI_threadpool_init(), and blender::compositor::pool.
Referenced by task_pool_create_ex().
|
static |
Definition at line 358 of file task_pool.cc.
References TaskPool::background_queue, background_task_pool_work_and_wait(), TaskPool::background_threads, BLI_thread_queue_free(), BLI_threadpool_end(), and blender::compositor::pool.
Referenced by BLI_task_pool_free().
Definition at line 317 of file task_pool.cc.
References TaskPool::background_queue, TaskPool::background_threads, BLI_available_threads(), BLI_thread_queue_push(), BLI_threadpool_insert(), MEM_mallocN, blender::compositor::pool, and blender::compositor::task.
Referenced by BLI_task_pool_push().
|
static |
Definition at line 328 of file task_pool.cc.
References TaskPool::background_queue, TaskPool::background_threads, BLI_thread_queue_nowait(), BLI_thread_queue_wait_finish(), BLI_threadpool_clear(), and blender::compositor::pool.
Referenced by background_task_pool_free(), and BLI_task_pool_work_and_wait().
|
static |
Definition at line 300 of file task_pool.cc.
References TaskPool::background_queue, BLI_thread_queue_pop(), MEM_freeN, blender::compositor::pool, and blender::compositor::task.
Referenced by background_task_pool_create().
| void BLI_task_pool_cancel | ( | TaskPool * | pool | ) |
Definition at line 511 of file task_pool.cc.
References background_task_pool_cancel(), blender::compositor::pool, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, TASK_POOL_NO_THREADS, TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, tbb_task_pool_cancel(), and TaskPool::type.
Referenced by filelist_cache_previews_clear().
| TaskPool* BLI_task_pool_create | ( | void * | userdata, |
| TaskPriority | priority | ||
| ) |
Create a normal task pool. Tasks will be executed as soon as they are added.
Definition at line 406 of file task_pool.cc.
References task_pool_create_ex(), and TASK_POOL_TBB.
Referenced by BKE_editmesh_loop_tangent_calc(), BKE_lib_override_library_main_operations_create(), BKE_mesh_calc_loop_tangent_ex(), BKE_mesh_normals_loop_split(), BLI_task_parallel_mempool(), distribute_particles_on_dm(), do_sequence_proxy(), IMB_processor_apply_threaded(), IMB_processor_apply_threaded_scanlines(), lineart_main_occlusion_begin(), psys_cache_child_paths(), screen_opengl_render_init(), start_prefetch_threads(), task_parallel_iterator_do(), and blender::compositor::threading_model_task_start().
| TaskPool* BLI_task_pool_create_background | ( | void * | userdata, |
| TaskPriority | priority | ||
| ) |
Create a background task pool. In multi-threaded context, there is no differences with BLI_task_pool_create(), but in single-threaded case it is ensured to have at least one worker thread to run on (i.e. you don't have to call BLI_task_pool_work_and_wait on it to be sure it will be processed).
Definition at line 423 of file task_pool.cc.
References TASK_POOL_BACKGROUND, and task_pool_create_ex().
Referenced by filelist_cache_preview_ensure_running().
| TaskPool* BLI_task_pool_create_background_serial | ( | void * | userdata, |
| TaskPriority | priority | ||
| ) |
Task pool that executes one task after the other, possibly on different threads but never in parallel.
Definition at line 451 of file task_pool.cc.
References TASK_POOL_BACKGROUND_SERIAL, and task_pool_create_ex().
Referenced by screen_opengl_render_init().
| TaskPool* BLI_task_pool_create_no_threads | ( | void * | userdata | ) |
Single threaded task pool that executes pushed task immediately, for debugging purposes.
Definition at line 442 of file task_pool.cc.
References task_pool_create_ex(), TASK_POOL_NO_THREADS, and TASK_PRIORITY_HIGH.
Referenced by blender::deg::deg_evaluate_task_pool_create().
| TaskPool* BLI_task_pool_create_suspended | ( | void * | userdata, |
| TaskPriority | priority | ||
| ) |
Similar to BLI_task_pool_create() but does not schedule any tasks for execution for until BLI_task_pool_work_and_wait() is called. This helps reducing threading overhead when pushing huge amount of small initial tasks from the main thread.
Definition at line 433 of file task_pool.cc.
References task_pool_create_ex(), and TASK_POOL_TBB_SUSPENDED.
Referenced by blender::deg::deg_evaluate_task_pool_create(), project_paint_op(), and TEST().
| bool BLI_task_pool_current_canceled | ( | TaskPool * | pool | ) |
Definition at line 526 of file task_pool.cc.
References background_task_pool_canceled(), BLI_assert, blender::compositor::pool, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, TASK_POOL_NO_THREADS, TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, tbb_task_pool_canceled(), and TaskPool::type.
| void BLI_task_pool_free | ( | TaskPool * | pool | ) |
Definition at line 456 of file task_pool.cc.
References background_task_pool_free(), BLI_mutex_end(), MEM_freeN, blender::compositor::pool, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, TASK_POOL_NO_THREADS, TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, tbb_task_pool_free(), TaskPool::type, and TaskPool::user_mutex.
Referenced by BKE_editmesh_loop_tangent_calc(), BKE_lib_override_library_main_operations_create(), BKE_mesh_calc_loop_tangent_ex(), BKE_mesh_normals_loop_split(), BLI_task_parallel_mempool(), blender::deg::deg_evaluate_on_refresh(), distribute_particles_on_dm(), do_sequence_proxy(), filelist_cache_previews_free(), IMB_processor_apply_threaded(), IMB_processor_apply_threaded_scanlines(), lineart_main_occlusion_begin(), project_paint_op(), psys_cache_child_paths(), screen_opengl_render_end(), start_prefetch_threads(), task_parallel_iterator_do(), TEST(), blender::compositor::threading_model_task_stop(), and um_arraystore_free().
| void BLI_task_pool_push | ( | TaskPool * | pool, |
| TaskRunFunction | run, | ||
| void * | taskdata, | ||
| bool | free_taskdata, | ||
| TaskFreeFunction | freedata | ||
| ) |
Definition at line 475 of file task_pool.cc.
References background_task_pool_run(), blender::compositor::pool, blender::compositor::task, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, TASK_POOL_NO_THREADS, TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, tbb_task_pool_run(), and TaskPool::type.
Referenced by BKE_editmesh_loop_tangent_calc(), BKE_lib_override_library_main_operations_create(), BKE_mesh_calc_loop_tangent_ex(), BLI_task_parallel_mempool(), distribute_particles_on_dm(), do_sequence_proxy(), filelist_cache_previews_push(), IMB_processor_apply_threaded(), IMB_processor_apply_threaded_scanlines(), lineart_main_occlusion_begin(), loop_split_generator(), project_paint_op(), psys_cache_child_paths(), schedule_write_result(), start_prefetch_threads(), task_parallel_iterator_do(), TEST(), and blender::compositor::threading_model_task_schedule().
| void* BLI_task_pool_user_data | ( | TaskPool * | pool | ) |
Definition at line 541 of file task_pool.cc.
References blender::compositor::pool, and TaskPool::userdata.
Referenced by filelist_cache_preview_runf(), lib_override_library_operations_create_cb(), loop_split_worker(), parallel_iterator_func(), parallel_mempool_func(), prefetch_task_func(), processor_apply_func(), processor_apply_scanline_func(), proxy_task_func(), and write_result_func().
| ThreadMutex* BLI_task_pool_user_mutex | ( | TaskPool * | pool | ) |
Definition at line 546 of file task_pool.cc.
References blender::compositor::pool, and TaskPool::user_mutex.
| void BLI_task_pool_work_and_wait | ( | TaskPool * | pool | ) |
Definition at line 496 of file task_pool.cc.
References background_task_pool_work_and_wait(), blender::compositor::pool, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, TASK_POOL_NO_THREADS, TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, tbb_task_pool_work_and_wait(), and TaskPool::type.
Referenced by BKE_editmesh_loop_tangent_calc(), BKE_lib_override_library_main_operations_create(), BKE_mesh_calc_loop_tangent_ex(), BKE_mesh_normals_loop_split(), BLI_task_parallel_mempool(), blender::deg::deg_evaluate_on_refresh(), distribute_particles_on_dm(), do_sequence_proxy(), IMB_processor_apply_threaded(), IMB_processor_apply_threaded_scanlines(), lineart_main_occlusion_begin(), project_paint_op(), psys_cache_child_paths(), screen_opengl_render_end(), start_prefetch_threads(), task_parallel_iterator_do(), TEST(), blender::compositor::threading_model_task_finish(), undomesh_free_data(), undomesh_from_editmesh(), and undomesh_to_editmesh().
|
static |
Definition at line 368 of file task_pool.cc.
References background_task_pool_create(), BLI_mutex_init(), BLI_task_scheduler_num_threads(), MEM_callocN, blender::compositor::pool, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, TASK_POOL_NO_THREADS, TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, tbb_task_pool_create(), TaskPool::type, type, TaskPool::use_threads, TaskPool::user_mutex, and TaskPool::userdata.
Referenced by BLI_task_pool_create(), BLI_task_pool_create_background(), BLI_task_pool_create_background_serial(), BLI_task_pool_create_no_threads(), and BLI_task_pool_create_suspended().
|
static |
Definition at line 258 of file task_pool.cc.
References blender::compositor::pool, TaskPool::tbb_group, UNUSED_VARS, and TaskPool::use_threads.
Referenced by BLI_task_pool_cancel().
|
static |
Definition at line 270 of file task_pool.cc.
References blender::compositor::pool, UNUSED_VARS, and TaskPool::use_threads.
Referenced by BLI_task_pool_current_canceled().
|
static |
Definition at line 191 of file task_pool.cc.
References BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_create(), TaskPool::is_suspended, blender::compositor::pool, TaskPool::suspended_mempool, TASK_POOL_TBB_SUSPENDED, TaskPool::tbb_group, TaskPool::type, UNUSED_VARS, and TaskPool::use_threads.
Referenced by task_pool_create_ex().
|
static |
Definition at line 283 of file task_pool.cc.
References BLI_mempool_destroy(), blender::compositor::pool, TaskPool::suspended_mempool, TaskPool::tbb_group, and TaskPool::use_threads.
Referenced by BLI_task_pool_free().
Definition at line 207 of file task_pool.cc.
References BLI_mempool_alloc(), TaskPool::is_suspended, blender::compositor::pool, TaskPool::suspended_mempool, blender::compositor::task, TaskPool::tbb_group, and TaskPool::use_threads.
Referenced by BLI_task_pool_push(), and tbb_task_pool_work_and_wait().
|
static |
Definition at line 233 of file task_pool.cc.
References BLI_mempool_clear(), BLI_mempool_iternew(), BLI_mempool_iterstep(), TaskPool::is_suspended, blender::compositor::pool, TaskPool::suspended_mempool, blender::compositor::task, TaskPool::tbb_group, tbb_task_pool_run(), and TaskPool::use_threads.
Referenced by BLI_task_pool_work_and_wait().