Skip to content

Commit 7215a2d

Browse files
updated subflow.cpp
1 parent 78c028d commit 7215a2d

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set(CMAKE_CXX_STANDARD 17)
1515
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1616
set(CMAKE_CXX_EXTENSIONS OFF)
1717
#set(USE_WERROR ON)
18-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2")
18+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2 -std=libc++")
1919
message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
2020
message(STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER})
2121
message(STATUS "CMAKE_CXX_COMPILER_VERSION: " ${CMAKE_CXX_COMPILER_VERSION})

example/subflow.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
// We first create four tasks A, B, C, and D. During the execution
55
// of B, it uses flow builder to creates another three tasks
66
// B1, B2, and B3, and adds dependencies from B1 and B2 to B3.
7+
//
8+
// We use dispatch and get to wait until the graph finished.
9+
// Do so is difference from "wait_for_all" which will clean up the
10+
// finished graphs. After the graph finished, we dump the topology
11+
// for inspection.
712

813
#include <taskflow.hpp>
914

@@ -53,9 +58,13 @@ int main() {
5358
B.precede(D); // D runs after B
5459
C.precede(D); // D runs after C
5560

56-
tf.wait_for_all(); // block until finished
61+
tf.dispatch().get(); // block until finished
62+
63+
// Now we can dump the topology
64+
std::cout << tf.dump_topologies();
5765

5866
return 0;
5967
}
6068

6169

70+

taskflow.hpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23-
#ifndef TASKFLOW_HPP_
24-
#define TASKFLOW_HPP_
23+
#pragma once
2524

2625
#include <iostream>
2726
#include <cstdio>
@@ -1758,14 +1757,6 @@ using FlowBuilder = typename Taskflow::FlowBuilderType;
17581757
}; // end of namespace tf. ---------------------------------------------------
17591758

17601759

1761-
#endif
1762-
1763-
1764-
1765-
1766-
1767-
1768-
17691760

17701761

17711762

unittest/taskflow.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ TEST_CASE("Taskflow.ReduceMax" * doctest::timeout(5)) {
375375
}
376376

377377
// --------------------------------------------------------
378-
// Testcase: Taskflow.Subflow
378+
// Testcase: Taskflow.JoinedSubflow
379379
// --------------------------------------------------------
380380
TEST_CASE("Taskflow.JoinedSubflow" * doctest::timeout(5)){
381381

@@ -545,7 +545,9 @@ TEST_CASE("Taskflow.JoinedSubflow" * doctest::timeout(5)){
545545
}
546546
}
547547

548-
// Testcase: Subflow.Detach
548+
// --------------------------------------------------------
549+
// Testcase: Taskflow.DetachedSubflow
550+
// --------------------------------------------------------
549551
TEST_CASE("Taskflow.DetachedSubflow" * doctest::timeout(5)) {
550552

551553
using namespace std::literals::chrono_literals;

0 commit comments

Comments
 (0)