Use cleaner function for spawning TBB tasks
parent
0bb5d1595d
commit
b050e96b93
|
@ -155,18 +155,14 @@ namespace gtsam {
|
||||||
// Set TBB ref count
|
// Set TBB ref count
|
||||||
set_ref_count(1 + (int)roots.size());
|
set_ref_count(1 + (int)roots.size());
|
||||||
// Create data and tasks for our children
|
// Create data and tasks for our children
|
||||||
FastVector<PreOrderTask*> tasks;
|
tbb::task_list tasks;
|
||||||
tasks.reserve(roots.size());
|
|
||||||
BOOST_FOREACH(const boost::shared_ptr<NODE>& root, roots)
|
BOOST_FOREACH(const boost::shared_ptr<NODE>& root, roots)
|
||||||
{
|
{
|
||||||
tasks.push_back(new(allocate_child())
|
tasks.push_back(*new(allocate_child())
|
||||||
PreOrderTask(root, visitorPre(root, myData), visitorPre, visitorPost, problemSizeThreshold));
|
PreOrderTask(root, visitorPre(root, myData), visitorPre, visitorPost, problemSizeThreshold));
|
||||||
}
|
}
|
||||||
// Spawn tasks
|
// Spawn tasks
|
||||||
BOOST_FOREACH(PreOrderTask* task, tasks)
|
spawn_and_wait_for_all(tasks);
|
||||||
spawn(*task);
|
|
||||||
// Wait for tasks to finish
|
|
||||||
wait_for_all();
|
|
||||||
// Return NULL
|
// Return NULL
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue