Permalink
tsung-wei-huang
updated README
5a853d0
May 16, 2019
Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up| // A simple example to capture the following task dependencies. | |
| // | |
| // TaskA---->TaskB---->TaskD | |
| // TaskA---->TaskC---->TaskD | |
| #include <taskflow/taskflow.hpp> // the only include you need | |
| int main(){ | |
| tf::Taskflow taskflow; | |
| auto [A, B, C, D] = taskflow.emplace( | |
| [] () { std::cout << "TaskA\n"; }, // | |
| [] () { std::cout << "TaskB\n"; }, // +---+ | |
| [] () { std::cout << "TaskC\n"; }, // +---->| B |-----+ | |
| [] () { std::cout << "TaskD\n"; } // | +---+ | | |
| ); // +---+ +-v-+ | |
| // | A | | D | | |
| A.precede(B); // B runs after A // +---+ +-^-+ | |
| A.precede(C); // C runs after A // | +---+ | | |
| B.precede(D); // D runs after B // +---->| C |-----+ | |
| C.precede(D); // D runs after C // +---+ | |
| tf::Executor().run(taskflow); // create an executor to run the taskflow | |
| return 0; | |
| } | |