Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_task.h
| Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings) | ||||
| /* Use default heuristic to define actual chunk size. */ | /* Use default heuristic to define actual chunk size. */ | ||||
| settings->min_iter_per_thread = 0; | settings->min_iter_per_thread = 0; | ||||
| } | } | ||||
| /* Don't use this, store any thread specific data in tls->userdata_chunk instead. | /* Don't use this, store any thread specific data in tls->userdata_chunk instead. | ||||
| * Ony here for code to be removed. */ | * Ony here for code to be removed. */ | ||||
| int BLI_task_parallel_thread_id(const TaskParallelTLS *tls); | int BLI_task_parallel_thread_id(const TaskParallelTLS *tls); | ||||
| /* Task Graph Scheduling */ | |||||
| /* See `BLI_task_graph_test.cc` for example usages. */ | |||||
| struct TaskGraph; | |||||
| struct TaskNode; | |||||
| typedef void (*TaskGraphNodeRunFunction)(void *__restrict task_data); | |||||
| typedef void (*TaskGraphNodeFreeFunction)(void *task_data); | |||||
| /* Create a new task graph. In a task graph data flows from node to node, where every node can be | |||||
| * run in its own thread. */ | |||||
| struct TaskGraph *BLI_task_graph_create(void); | |||||
| /* Wait for all work in the given task_graph is finished */ | |||||
| void BLI_task_graph_work_and_wait(struct TaskGraph *task_graph); | |||||
| /* Free the task_graph */ | |||||
| void BLI_task_graph_free(struct TaskGraph *task_graph); | |||||
| /* Create a new node in the given task_graph. You never need to free the TaskNode asn the | |||||
| * task_graph is the owner. */ | |||||
| struct TaskNode *BLI_task_graph_node_create(struct TaskGraph *task_graph, | |||||
| TaskGraphNodeRunFunction run, | |||||
| void *task_data, | |||||
| TaskGraphNodeFreeFunction free_func); | |||||
| /* Push work (schedule) to a specific node. */ | |||||
| bool BLI_task_graph_node_push_work(struct TaskNode *task_node); | |||||
| /* Make a link between two nodes. When from_node completes processing the given data, the data is | |||||
| * forwarded to the to_node. */ | |||||
| void BLI_task_graph_edge_create(struct TaskNode *from_node, struct TaskNode *to_node); | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| #endif | #endif | ||||
| #endif | #endif | ||||