@@ -15,31 +15,28 @@ It is by far faster, more expressive, and easier for drop-in integration than ex
1515
1616# Get Started with Cpp-Taskflow
1717
18- The following example [ simple.cpp] ( ./example/simple.cpp ) contains the basic syntax you need to use Cpp-Taskflow.
18+ The following example [ simple.cpp] ( ./example/simple.cpp ) shows the basic API you need to use Cpp-Taskflow.
1919
2020``` cpp
21- // TaskA---->TaskB---->TaskD
22- // TaskA---->TaskC---->TaskD
23-
2421#include " taskflow.hpp" // the only include you need
2522
2623int main (){
2724
2825 tf::Taskflow tf(std::thread : :hardware_concurrency());
2926
3027 auto [ A, B, C, D] = tf.silent_emplace(
31- [ ] () { std::cout << "TaskA\n"; },
32- [ ] () { std::cout << "TaskB\n"; },
33- [ ] () { std::cout << "TaskC\n"; },
34- [ ] () { std::cout << "TaskD\n"; }
35- );
36-
37- A.precede(B); // B runs after A
38- A.precede(C); // C runs after A
39- B.precede(D); // D runs after B
40- C.precede(D); // C runs after D
41-
42- tf.wait_for_all(); // block until all tasks finish
28+ [ ] () { std::cout << "TaskA\n"; }, // the taskflow graph
29+ [ ] () { std::cout << "TaskB\n"; }, //
30+ [ ] () { std::cout << "TaskC\n"; }, // +---+
31+ [ ] () { std::cout << "TaskD\n"; } // +---->| B |-----+
32+ ); // | +---+ |
33+ // +---+ +-v-+
34+ A.precede(B); // B runs after A // | A | | D |
35+ A.precede(C); // C runs after A // +---+ +-^-+
36+ B.precede(D); // D runs after B // | +---+ |
37+ C.precede(D); // C runs after D // +---->| C |-----+
38+ // +---+
39+ tf.wait_for_all(); // block until finished
4340
4441 return 0;
4542}
0 commit comments