3 ms·
I added a more realistic example, parallel_merge_sort, which demonstrates how to pass values and how to avoid a data race among tasks. https://github.com/noneb
by noneback 2y ago
I added a more realistic example, parallel_merge_sort, which demonstrates how to pass values and how to avoid a data race among tasks.
https://github.com/noneback/go-taskflow/blob/main/examples/parallel_merge_sort/parallel_merge_sort.go https://github.com/noneback/go-taskflow/blob/main/examples/p...
- atombender 2y agoVery helpful, thank you. This also makes it apparent (it wasn't clear to me before) that each graph is declared alongside the data. You cannot reuse a graph to run multiple times on different data; you define the graph every time.
- noneback 2y agoYes. Data is attached to tasks via Go Native variable binding. Values are captured by task function once defined (closure). In some cases, You can change the value of the variable(like changing the value of ptr, rather than ptr itself) and rerun the whole graph to support your cases.