Skip to content

Commit 9b0b986

Browse files
updated subflow
1 parent ea5943e commit 9b0b986

5 files changed

Lines changed: 10 additions & 170 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ target_link_libraries(simple ${PROJECT_NAME} Threads::Threads)
116116
add_executable(subflow ${TF_EXAMPLE_DIR}/subflow.cpp)
117117
target_link_libraries(subflow ${PROJECT_NAME} Threads::Threads)
118118

119-
add_executable(nested_subflow ${TF_EXAMPLE_DIR}/nested_subflow.cpp)
120-
target_link_libraries(nested_subflow ${PROJECT_NAME} Threads::Threads)
121-
122119
add_executable(debug ${TF_EXAMPLE_DIR}/debug.cpp)
123120
target_link_libraries(debug ${PROJECT_NAME} Threads::Threads)
124121

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ These tasks are spawned by a parent task and are grouped together to a *subflow*
192192
The example below demonstrates how to create a subflow
193193
that spawns three tasks during its execution.
194194

195-
<img align="right" src="image/subflow_join.png" width="30%">
195+
<img align="right" src="image/subflow_join.png" width="35%">
196196

197197
```cpp
198198
// create three regular tasks
@@ -225,17 +225,18 @@ its parent node.
225225
You can disable this feature by calling `subflow.detach()`.
226226
Detaching the above subflow will result in the following execution flow.
227227

228-
<img align="right" src="image/subflow_detach.png" width="40%">
228+
<img align="right" src="image/subflow_detach.png" width="35%">
229229

230230
```cpp
231-
// detach a subflow graph
232-
[] (auto& subflow) {
231+
// spawn a subflow from TaskB
232+
[] (tf::SubflowBuilder& subflow) {
233233
...
234234
B1.precede(B3);
235235
B2.precede(B3);
236236

237-
// detach from B
237+
// detach from TaskB
238238
subflow.detach();
239+
239240
}).name("TaskB");
240241
```
241242

@@ -277,13 +278,13 @@ the execution of a subflow and so on.
277278
<img align="right" src="image/nested_subflow.png" width="25%">
278279

279280
```cpp
280-
tf::Task A = tf.emplace([] (tf::SubflowBuilder& sbf){
281+
tf::Task A = tf.emplace([] (tf::SubflowBuilder& sbf) {
281282
std::cout << "A spawns A1 & subflow A2\n";
282283
tf::Task A1 = sbf.emplace([] () {
283284
std::cout << "subtask A1\n";
284285
}).name("A1");
285286

286-
tf::Task A2 = sbf.emplace([](tf::SubflowBuilder& sbf2){
287+
tf::Task A2 = sbf.emplace([] (tf::SubflowBuilder& sbf2) {
287288
std::cout << "A2 spawns A2_1 & A2_2\n";
288289
tf::Task A2_1 = sbf2.emplace([] () {
289290
std::cout << "subtask A2_1\n";
@@ -293,6 +294,7 @@ tf::Task A = tf.emplace([] (tf::SubflowBuilder& sbf){
293294
}).name("A2_2");
294295
A2_1.precede(A2_2);
295296
}).name("A2");
297+
296298
A1.precede(A2);
297299
}).name("A");
298300
```
@@ -413,7 +415,7 @@ digraph Taskflow {
413415
}
414416
```
415417

416-
## Dump the Dispatched Graphs
418+
## Dump a Dispatched Graph
417419

418420
When you have dynamic tasks (subflows),
419421
you cannot simply use the `dump` method because it displays only the static portion.

example/nested_subflow.cpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

image/graph_algorithm.txt

Lines changed: 0 additions & 47 deletions
This file was deleted.

image/matrix_operation.txt

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)