Macaulay2 Engine
Loading...
Searching...
No Matches

◆ createNode()

NodePtr createNode ( tbb::flow::graph & G,
int lev,
int sldeg )

Definition at line 81 of file res-tasking-example.cpp.

82{
83 return std::make_shared<Node>(G,
84 [lev, sldeg](const tbb::flow::continue_msg &msg)
85 {
86 int sleepTime = uni(rng);
87 std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));;
88 std::lock_guard<std::mutex> guard(myMutex);
89 std::cout << "computed lev=" << lev << " sldeg="
90 << sldeg << " sum=" << lev + sldeg
91 << " sleep time=" << sleepTime << std::endl;
92 return msg;
93 });
94}
std::uniform_int_distribution< int > uni(250, 1000)
std::mutex myMutex
tbb::flow::graph G
std::mt19937 rng(rd())

References G, myMutex, rng(), and uni().

Referenced by makeDependencyGraph().