|
Blender V5.0
|
#include <atomic>#include <cstdlib>#include <memory>#include <utility>#include "MEM_guardedalloc.h"#include "DNA_listBase.h"#include "BLI_assert.h"#include "BLI_mempool.h"#include "BLI_task.h"#include "BLI_threads.h"#include "BLI_vector.hh"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 } |
Functions | |
| TaskPool * | BLI_task_pool_create (void *userdata, eTaskPriority priority) |
| TaskPool * | BLI_task_pool_create_background (void *userdata, eTaskPriority priority) |
| TaskPool * | BLI_task_pool_create_suspended (void *userdata, eTaskPriority priority) |
| TaskPool * | BLI_task_pool_create_no_threads (void *userdata) |
| TaskPool * | BLI_task_pool_create_background_serial (void *userdata, eTaskPriority priority) |
| void | BLI_task_pool_free (TaskPool *pool) |
| void | BLI_task_pool_push (TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata) |
| void | BLI_task_pool_work_and_wait (TaskPool *pool) |
| void | BLI_task_pool_cancel (TaskPool *pool) |
| bool | BLI_task_pool_current_canceled (TaskPool *pool) |
| void * | BLI_task_pool_user_data (TaskPool *pool) |
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 149 of file task_pool.cc.
| void BLI_task_pool_cancel | ( | TaskPool * | pool | ) |
Cancel all tasks, keep worker threads running.
Definition at line 540 of file task_pool.cc.
References TaskPool::cancel().
Referenced by filelist_cache_previews_clear(), and blender::ed::vse::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 484 of file task_pool.cc.
References TASK_POOL_TBB.
Referenced by BKE_lib_override_library_main_operations_create(), BLI_task_parallel_mempool(), distribute_particles_on_dm(), do_sequence_proxy(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), blender::ed::vse::preview_startjob(), psys_cache_child_paths(), screen_opengl_render_init(), and start_prefetch_threads().
| 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 489 of file task_pool.cc.
References TASK_POOL_BACKGROUND.
Referenced by filelist_cache_preview_ensure_running(), blender::ed::sculpt_paint::undo::PositionUndoStorage::PositionUndoStorage(), 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 516 of file task_pool.cc.
References TASK_POOL_BACKGROUND_SERIAL.
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 511 of file task_pool.cc.
References 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 503 of file task_pool.cc.
References 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 545 of file task_pool.cc.
References TaskPool::current_canceled().
Referenced by blender::ed::vse::execute_read_sound_waveform_task(), and blender::gpu::VKDevice::submission_runner().
| void BLI_task_pool_free | ( | TaskPool * | pool | ) |
Definition at line 521 of file task_pool.cc.
Referenced by BKE_lib_override_library_main_operations_create(), BLI_task_parallel_mempool(), blender::deg::deg_evaluate_on_refresh(), distribute_particles_on_dm(), do_sequence_proxy(), filelist_cache_previews_free(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), blender::ed::vse::preview_startjob(), project_paint_op(), psys_cache_child_paths(), screen_opengl_render_end(), start_prefetch_threads(), TEST(), um_arraystore_free(), blender::fn::lazy_function::Executor::~Executor(), and blender::ed::sculpt_paint::undo::PositionUndoStorage::~PositionUndoStorage().
| void BLI_task_pool_push | ( | TaskPool * | pool, |
| TaskRunFunction | run, | ||
| void * | taskdata, | ||
| bool | free_taskdata, | ||
| TaskFreeFunction | freedata ) |
Definition at line 526 of file task_pool.cc.
References TaskPool::task_push().
Referenced by BKE_lib_override_library_main_operations_create(), BLI_task_parallel_mempool(), distribute_particles_on_dm(), do_sequence_proxy(), filelist_cache_previews_push(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), blender::ed::sculpt_paint::undo::PositionUndoStorage::PositionUndoStorage(), blender::ed::vse::preview_startjob(), project_paint_op(), psys_cache_child_paths(), schedule_write_result(), start_prefetch_threads(), TEST(), and undomesh_from_editmesh().
| void * BLI_task_pool_user_data | ( | TaskPool * | pool | ) |
Optional userdata pointer to pass along to run function.
Definition at line 550 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(), proxy_task_func(), blender::gpu::VKDevice::submission_runner(), and write_result().
| void BLI_task_pool_work_and_wait | ( | TaskPool * | pool | ) |
Work and wait until all tasks are done.
Definition at line 535 of file task_pool.cc.
References TaskPool::work_and_wait().
Referenced by BKE_lib_override_library_main_operations_create(), BLI_task_parallel_mempool(), distribute_particles_on_dm(), do_sequence_proxy(), blender::ed::sculpt_paint::undo::PositionUndoStorage::ensure_compression_complete(), blender::fn::lazy_function::Executor::execute(), lineart_main_add_triangles(), lineart_main_load_geometries(), lineart_main_occlusion_begin(), blender::ed::vse::preview_startjob(), project_paint_op(), psys_cache_child_paths(), screen_opengl_render_end(), start_prefetch_threads(), TEST(), undomesh_free_data(), undomesh_from_editmesh(), undomesh_to_editmesh(), and blender::ed::sculpt_paint::undo::PositionUndoStorage::~PositionUndoStorage().