diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-19 10:33:42 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-19 10:35:39 +0300 |
commit | 9c8255d486c1271f20d33debf2a9e9ce883b5019 (patch) | |
tree | b1f5af7bbe48f7cbc59a1a422c0a95f4ed764da9 /source/blender/blenlib | |
parent | 695dc07cb12222678f035537c554bee39d4d7d23 (diff) |
Cleanup: use 'e' prefix for enum types
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_task.h | 12 | ||||
-rw-r--r-- | source/blender/blenlib/intern/task_pool.cc | 14 |
2 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index 418db14e2f3..53ac5f7047b 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -62,10 +62,10 @@ int BLI_task_scheduler_num_threads(void); * be launched. */ -typedef enum TaskPriority { +typedef enum eTaskPriority { TASK_PRIORITY_LOW, TASK_PRIORITY_HIGH, -} TaskPriority; +} eTaskPriority; typedef struct TaskPool TaskPool; typedef void (*TaskRunFunction)(TaskPool *__restrict pool, void *taskdata); @@ -73,21 +73,21 @@ typedef void (*TaskFreeFunction)(TaskPool *__restrict pool, void *taskdata); /* Regular task pool that immediately starts executing tasks as soon as they * are pushed, either on the current or another thread. */ -TaskPool *BLI_task_pool_create(void *userdata, TaskPriority priority); +TaskPool *BLI_task_pool_create(void *userdata, eTaskPriority priority); /* Background: always run tasks in a background thread, never immediately * execute them. For running background jobs. */ -TaskPool *BLI_task_pool_create_background(void *userdata, TaskPriority priority); +TaskPool *BLI_task_pool_create_background(void *userdata, eTaskPriority priority); /* Background Serial: run tasks one after the other in the background, * without parallelization between the tasks. */ -TaskPool *BLI_task_pool_create_background_serial(void *userdata, TaskPriority priority); +TaskPool *BLI_task_pool_create_background_serial(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. */ -TaskPool *BLI_task_pool_create_suspended(void *userdata, TaskPriority priority); +TaskPool *BLI_task_pool_create_suspended(void *userdata, eTaskPriority priority); /* No threads: immediately executes tasks on the same thread. For debugging. */ TaskPool *BLI_task_pool_create_no_threads(void *userdata); diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc index cbb5bf34477..1651d4c2205 100644 --- a/source/blender/blenlib/intern/task_pool.cc +++ b/source/blender/blenlib/intern/task_pool.cc @@ -121,7 +121,7 @@ class Task { #ifdef WITH_TBB class TBBTaskGroup : public tbb::task_group { public: - TBBTaskGroup(TaskPriority priority) + TBBTaskGroup(eTaskPriority priority) { # if TBB_INTERFACE_VERSION_MAJOR >= 12 /* TODO: support priorities in TBB 2021, where they are only available as @@ -186,7 +186,7 @@ void Task::operator()() const * Tasks may be suspended until in all are created, to make it possible to * initialize data structures and create tasks in a single pass. */ -static void tbb_task_pool_create(TaskPool *pool, TaskPriority priority) +static void tbb_task_pool_create(TaskPool *pool, eTaskPriority priority) { if (pool->type == TASK_POOL_TBB_SUSPENDED) { pool->is_suspended = true; @@ -363,7 +363,7 @@ static void background_task_pool_free(TaskPool *pool) /* Task Pool */ -static TaskPool *task_pool_create_ex(void *userdata, TaskPoolType type, TaskPriority priority) +static TaskPool *task_pool_create_ex(void *userdata, TaskPoolType type, eTaskPriority priority) { const bool use_threads = BLI_task_scheduler_num_threads() > 1 && type != TASK_POOL_NO_THREADS; @@ -401,7 +401,7 @@ static TaskPool *task_pool_create_ex(void *userdata, TaskPoolType type, TaskPrio /** * Create a normal task pool. Tasks will be executed as soon as they are added. */ -TaskPool *BLI_task_pool_create(void *userdata, TaskPriority priority) +TaskPool *BLI_task_pool_create(void *userdata, eTaskPriority priority) { return task_pool_create_ex(userdata, TASK_POOL_TBB, priority); } @@ -418,7 +418,7 @@ TaskPool *BLI_task_pool_create(void *userdata, TaskPriority priority) * they could end never being executed, since the 'fallback' background thread is already * busy with parent task in single-threaded context). */ -TaskPool *BLI_task_pool_create_background(void *userdata, TaskPriority priority) +TaskPool *BLI_task_pool_create_background(void *userdata, eTaskPriority priority) { return task_pool_create_ex(userdata, TASK_POOL_BACKGROUND, priority); } @@ -428,7 +428,7 @@ TaskPool *BLI_task_pool_create_background(void *userdata, TaskPriority priority) * 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. */ -TaskPool *BLI_task_pool_create_suspended(void *userdata, TaskPriority priority) +TaskPool *BLI_task_pool_create_suspended(void *userdata, eTaskPriority priority) { return task_pool_create_ex(userdata, TASK_POOL_TBB_SUSPENDED, priority); } @@ -446,7 +446,7 @@ TaskPool *BLI_task_pool_create_no_threads(void *userdata) * Task pool that executes one task after the other, possibly on different threads * but never in parallel. */ -TaskPool *BLI_task_pool_create_background_serial(void *userdata, TaskPriority priority) +TaskPool *BLI_task_pool_create_background_serial(void *userdata, eTaskPriority priority) { return task_pool_create_ex(userdata, TASK_POOL_BACKGROUND_SERIAL, priority); } |