From e0cbc76456d5729b8b0a563595bc609535d6fcad Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Wed, 6 May 2020 16:47:16 -0400 Subject: [PATCH] change to more efficient call of threaded functions --- examples/SolverComparer.cpp | 2 +- examples/TimeTBB.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/SolverComparer.cpp b/examples/SolverComparer.cpp index cc5fdb26d..0845b42ae 100644 --- a/examples/SolverComparer.cpp +++ b/examples/SolverComparer.cpp @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) { #ifdef GTSAM_USE_TBB arena.execute([&]{ - tg.run([&]{ + tg.run_and_wait([&]{ #endif // Run mode if(incremental) diff --git a/examples/TimeTBB.cpp b/examples/TimeTBB.cpp index c25a19107..4bc5144f4 100644 --- a/examples/TimeTBB.cpp +++ b/examples/TimeTBB.cpp @@ -89,10 +89,9 @@ map testWithoutMemoryAllocation(int num_threads) // Run parallel code (as a task group) inside of task arena arena.execute([&]{ - tg.run([&]{ + tg.run_and_wait([&]{ tbb::parallel_for(tbb::blocked_range(0, numberOfProblems), WorkerWithoutAllocation(results)); }); - tg.wait(); }); tbb::tick_count t1 = tbb::tick_count::now(); @@ -154,10 +153,9 @@ map testWithMemoryAllocation(int num_threads) // Run parallel code (as a task group) inside of task arena arena.execute([&]{ - tg.run([&]{ + tg.run_and_wait([&]{ tbb::parallel_for(tbb::blocked_range(0, numberOfProblems), WorkerWithAllocation(results)); }); - tg.wait(); }); tbb::tick_count t1 = tbb::tick_count::now();