Blender V5.3
task_pool.cc File Reference
#include <atomic>
#include <cstdlib>
#include <memory>
#include <utility>
#include "MEM_guardedalloc.h"
#include "DNA_listBase.h"
#include "BLI_assert.hh"
#include "BLI_mempool.hh"
#include "BLI_task_c.hh"
#include "BLI_threads.hh"
#include "BLI_vector.hh"

Go to the source code of this file.

Classes

class  blender::Task
struct  blender::TaskPool

Namespaces

namespace  blender
 BMesh Iterators.

Enumerations

enum  blender::TaskPoolType {
  blender::TASK_POOL_TBB , blender::TASK_POOL_TBB_SUSPENDED , blender::TASK_POOL_NO_THREADS , blender::TASK_POOL_BACKGROUND ,
  blender::TASK_POOL_BACKGROUND_SERIAL
}

Functions

Task Pool

Pool of tasks that will be executed by the central task scheduler. For each pool, we can wait for all tasks to be done.

Running tasks may spawn new tasks.

Pools may be nested, i.e. a thread running a task can create another task pool with smaller tasks. When other threads are busy they will continue working on their own tasks, if not they will join in, no new threads will be launched.

Note: task cancellation used to be exposed too, but at least with TBB it has several non-intuitive repercussions (#152467, #143662); avoid re-adding it again.

TaskPool * blender::BLI_task_pool_create (void *userdata, eTaskPriority priority)
TaskPool * blender::BLI_task_pool_create_background (void *userdata, eTaskPriority priority)
TaskPool * blender::BLI_task_pool_create_suspended (void *userdata, eTaskPriority priority)
TaskPool * blender::BLI_task_pool_create_no_threads (void *userdata)
TaskPool * blender::BLI_task_pool_create_background_serial (void *userdata, eTaskPriority priority)
void blender::BLI_task_pool_free (TaskPool *pool)
void blender::BLI_task_pool_push (TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
void blender::BLI_task_pool_work_and_wait (TaskPool *pool)
void * blender::BLI_task_pool_user_data (TaskPool *pool)

Detailed Description

Task pool to run tasks in parallel.

Definition in file task_pool.cc.