31 # include <tbb/flow_graph.h>
39 std::vector<std::unique_ptr<TaskNode>>
nodes;
41 #ifdef WITH_CXX_GUARDEDALLOC
42 MEM_CXX_CLASS_ALLOC_FUNCS(
"task_graph:TaskGraph")
50 tbb::flow::continue_node<tbb::flow::continue_msg> tbb_node;
68 tbb_node(task_graph->tbb_graph,
70 [&](const tbb::flow::continue_msg input) { run(input); }),
92 tbb::flow::continue_msg run(
const tbb::flow::continue_msg
UNUSED(input))
95 return tbb::flow::continue_msg();
103 successor->run_serial();
107 #ifdef WITH_CXX_GUARDEDALLOC
108 MEM_CXX_CLASS_ALLOC_FUNCS(
"task_graph:TaskNode")
125 task_graph->tbb_graph.wait_for_all();
137 task_graph->
nodes.push_back(std::unique_ptr<TaskNode>(task_node));
145 return task_node->tbb_node.try_put(tbb::flow::continue_msg());
157 tbb::flow::make_edge(from_node->tbb_node, to_node->tbb_node);
int BLI_task_scheduler_num_threads(void)
void(* TaskGraphNodeFreeFunction)(void *task_data)
void(* TaskGraphNodeRunFunction)(void *__restrict task_data)
Read Guarded memory(de)allocation.
static PyObject * free_func(PyObject *, PyObject *value)
std::vector< std::unique_ptr< TaskNode > > nodes
TaskNode(TaskGraph *task_graph, TaskGraphNodeRunFunction run_func, void *task_data, TaskGraphNodeFreeFunction free_func)
TaskNode(const TaskNode &other)=delete
std::vector< TaskNode * > successors
TaskGraphNodeFreeFunction free_func
TaskNode & operator=(const TaskNode &other)=delete
TaskGraphNodeRunFunction run_func
TaskGraph * BLI_task_graph_create(void)
void BLI_task_graph_edge_create(struct TaskNode *from_node, struct TaskNode *to_node)
bool BLI_task_graph_node_push_work(struct TaskNode *task_node)
void BLI_task_graph_work_and_wait(TaskGraph *task_graph)
struct TaskNode * BLI_task_graph_node_create(struct TaskGraph *task_graph, TaskGraphNodeRunFunction run, void *user_data, TaskGraphNodeFreeFunction free_func)
void BLI_task_graph_free(TaskGraph *task_graph)