11 #ifndef __UT_TASKLIST_H_INCLUDED__
12 #define __UT_TASKLIST_H_INCLUDED__
17 #include <tbb/parallel_for.h>
18 #include <tbb/task_group.h>
20 #include <type_traits>
32 return myTasks.empty();
42 template <
typename Body>
45 myTasks.emplace_back(std::forward<Body>(task));
53 for (
auto&& task : myTasks)
55 tg.run([parent, task]() {
66 for (
auto&& task : myTasks)
73 std::vector<std::function<void()>> myTasks;
78 template <
typename RANGE,
typename BODY>
88 [
range = std::forward<RANGE>(
range), body = std::forward<BODY>(body)]()
95 #endif // __UT_TASKLIST_H_INCLUDED__
void parallel_for(int64_t start, int64_t end, std::function< void(int64_t index)> &&task, parallel_options opt=parallel_options(0, Split_Y, 1))
void spawnRootAndWait()
Spawn this task list as root tasks and wait.
static const UT_TaskScope * getCurrent()
void append(Body &&task)
Append a task.
static bool isThreadingEnabled()
void UTparallelForAppendToTaskList(UT_TaskList &task_list, RANGE &&range, BODY &&body)
void clear()
Removes all tasks.
bool isEmpty() const
Returns true when number of tasks is non-zero.
void runSerial()
Run this task list in serial.