|
Blender V4.3
|
#include <cstdlib>#include <memory>#include <utility>#include "MEM_guardedalloc.h"#include "DNA_listBase.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 140 of file task_pool.cc.
|
static |
Definition at line 328 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(), and MEM_freeN().
Referenced by BLI_task_pool_cancel().
|
static |
Definition at line 344 of file task_pool.cc.
References TaskPool::background_is_canceling.
Referenced by BLI_task_pool_current_canceled().
|
static |
Definition at line 302 of file task_pool.cc.
References TaskPool::background_queue, background_task_run(), TaskPool::background_threads, BLI_thread_queue_init(), and BLI_threadpool_init().
Referenced by task_pool_create_ex().
|
static |
Definition at line 349 of file task_pool.cc.
References TaskPool::background_queue, background_task_pool_work_and_wait(), TaskPool::background_threads, BLI_thread_queue_free(), and BLI_threadpool_end().
Referenced by BLI_task_pool_free().
Definition at line 308 of file task_pool.cc.
References TaskPool::background_queue, TaskPool::background_threads, BLI_available_threads(), BLI_thread_queue_push(), BLI_threadpool_insert(), and MEM_mallocN.
Referenced by BLI_task_pool_push().
|
static |
Definition at line 319 of file task_pool.cc.
References TaskPool::background_queue, TaskPool::background_threads, BLI_thread_queue_nowait(), BLI_thread_queue_wait_finish(), and BLI_threadpool_clear().
Referenced by background_task_pool_free(), and BLI_task_pool_work_and_wait().
|
static |
Definition at line 291 of file task_pool.cc.
References TaskPool::background_queue, BLI_thread_queue_pop(), and MEM_freeN().
Referenced by background_task_pool_create().
| void BLI_task_pool_cancel | ( | TaskPool * | pool | ) |
Cancel all tasks, keep worker threads running.
Definition at line 486 of file task_pool.cc.
References background_task_pool_cancel(), 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(), and preview_startjob().
| TaskPool * BLI_task_pool_create | ( | void * | userdata, |
| eTaskPriority | priority ) |
Regular task pool that immediately starts executing tasks as soon as they are pushed, either on the current or another thread.
Tasks will be executed as soon as they are added.
Definition at line 394 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(), BLI_task_parallel_mempool(), distribute_particles_on_dm(), do_sequence_proxy(), IMB_processor_apply_threaded(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), preview_startjob(), psys_cache_child_paths(), screen_opengl_render_init(), start_prefetch_threads(), blender::compositor::threading_model_task_start(), and blender::gpu::VKShaderCompiler::VKShaderCompiler().
| TaskPool * BLI_task_pool_create_background | ( | void * | userdata, |
| eTaskPriority | priority ) |
Background: always run tasks in a background thread, never immediately execute them. For running background jobs.
Definition at line 399 of file task_pool.cc.
References TASK_POOL_BACKGROUND, and task_pool_create_ex().
Referenced by filelist_cache_preview_ensure_running(), and undomesh_from_editmesh().
| TaskPool * BLI_task_pool_create_background_serial | ( | void * | userdata, |
| eTaskPriority | priority ) |
Background Serial: run tasks one after the other in the background.
Executes one task after the other, possibly on different threads but never in parallel.
Definition at line 426 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 | ) |
No threads: immediately executes tasks on the same thread. For debugging purposes.
Definition at line 421 of file task_pool.cc.
References task_pool_create_ex(), TASK_POOL_NO_THREADS, and TASK_PRIORITY_HIGH.
| TaskPool * BLI_task_pool_create_suspended | ( | void * | userdata, |
| eTaskPriority | priority ) |
Suspended: don't execute tasks until work_and_wait is called. This is slower as threads can't immediately start working. But it can be used if the data structures the threads operate on are not fully initialized until all tasks are created.
Definition at line 413 of file task_pool.cc.
References task_pool_create_ex(), and TASK_POOL_TBB_SUSPENDED.
Referenced by project_paint_op(), and TEST().
| bool BLI_task_pool_current_canceled | ( | TaskPool * | pool | ) |
For worker threads, test if current task pool canceled. this function may only be called from worker threads and pool must be the task pool that the thread is currently executing a task from.
Definition at line 501 of file task_pool.cc.
References background_task_pool_canceled(), BLI_assert_msg, 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.
Referenced by execute_read_sound_waveform_task().
| void BLI_task_pool_free | ( | TaskPool * | pool | ) |
Definition at line 431 of file task_pool.cc.
References background_task_pool_free(), BLI_mutex_end(), MEM_freeN(), 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(), 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(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), preview_startjob(), project_paint_op(), psys_cache_child_paths(), screen_opengl_render_end(), start_prefetch_threads(), TEST(), blender::compositor::threading_model_task_stop(), um_arraystore_free(), blender::fn::lazy_function::Executor::~Executor(), and blender::gpu::VKShaderCompiler::~VKShaderCompiler().
| void BLI_task_pool_push | ( | TaskPool * | pool, |
| TaskRunFunction | run, | ||
| void * | taskdata, | ||
| bool | free_taskdata, | ||
| TaskFreeFunction | freedata ) |
Definition at line 450 of file task_pool.cc.
References background_task_pool_run(), 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 blender::gpu::VKShaderCompiler::batch_compile(), 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(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), project_paint_op(), psys_cache_child_paths(), push_preview_job_audio_task(), schedule_write_result(), start_prefetch_threads(), TEST(), blender::compositor::threading_model_task_schedule(), and undomesh_from_editmesh().
| void * BLI_task_pool_user_data | ( | TaskPool * | pool | ) |
Optional userdata pointer to pass along to run function.
Definition at line 516 of file task_pool.cc.
References TaskPool::userdata.
Referenced by filelist_cache_preview_runf(), lib_override_library_operations_create_cb(), parallel_mempool_func(), prefetch_task_func(), processor_apply_func(), proxy_task_func(), and write_result().
| ThreadMutex * BLI_task_pool_user_mutex | ( | TaskPool * | pool | ) |
Optional mutex to use from run function.
Definition at line 521 of file task_pool.cc.
References TaskPool::user_mutex.
| void BLI_task_pool_work_and_wait | ( | TaskPool * | pool | ) |
Work and wait until all tasks are done.
Definition at line 471 of file task_pool.cc.
References background_task_pool_work_and_wait(), 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(), BLI_task_parallel_mempool(), distribute_particles_on_dm(), do_sequence_proxy(), blender::fn::lazy_function::Executor::execute(), IMB_processor_apply_threaded(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), preview_startjob(), project_paint_op(), psys_cache_child_paths(), screen_opengl_render_end(), start_prefetch_threads(), TEST(), blender::compositor::threading_model_task_finish(), undomesh_free_data(), undomesh_from_editmesh(), undomesh_to_editmesh(), and blender::gpu::VKShaderCompiler::~VKShaderCompiler().
|
static |
Definition at line 359 of file task_pool.cc.
References background_task_pool_create(), BLI_mutex_init(), BLI_task_scheduler_num_threads(), MEM_callocN, TASK_POOL_BACKGROUND, TASK_POOL_BACKGROUND_SERIAL, TASK_POOL_NO_THREADS, TASK_POOL_TBB, TASK_POOL_TBB_SUSPENDED, tbb_task_pool_create(), TaskPool::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 249 of file task_pool.cc.
References TaskPool::tbb_group, UNUSED_VARS, and TaskPool::use_threads.
Referenced by BLI_task_pool_cancel().
|
static |
Definition at line 261 of file task_pool.cc.
References UNUSED_VARS, and TaskPool::use_threads.
Referenced by BLI_task_pool_current_canceled().
|
static |
Definition at line 182 of file task_pool.cc.
References BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_create(), TaskPool::is_suspended, 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 274 of file task_pool.cc.
References BLI_mempool_destroy(), TaskPool::suspended_mempool, TaskPool::tbb_group, and TaskPool::use_threads.
Referenced by BLI_task_pool_free().
Definition at line 198 of file task_pool.cc.
References BLI_mempool_alloc(), TaskPool::is_suspended, TaskPool::suspended_mempool, TaskPool::tbb_group, and TaskPool::use_threads.
Referenced by BLI_task_pool_push(), and tbb_task_pool_work_and_wait().
|
static |
Definition at line 224 of file task_pool.cc.
References BLI_mempool_clear(), BLI_mempool_iternew(), BLI_mempool_iterstep(), TaskPool::is_suspended, TaskPool::suspended_mempool, TaskPool::tbb_group, tbb_task_pool_run(), and TaskPool::use_threads.
Referenced by BLI_task_pool_work_and_wait().