Attempting to fix a TBB crash

release/4.3a0
Richard Roberts 2013-09-10 15:45:12 +00:00
parent a8d1072a02
commit 22dc80e4ff
1 changed files with 5 additions and 2 deletions

View File

@ -107,9 +107,12 @@ namespace gtsam {
tbb::task_list childTasks;
BOOST_FOREACH(const boost::shared_ptr<NODE>& child, node->children)
{
// Process child in a subtask
// Process child in a subtask. Important: Run visitorPre before calling
// allocate_child so that if visitorPre throws an exception, we will not have
// allocated an extra child, this causes a TBB error.
const DATA childData = visitorPre(child, myData);
childTasks.push_back(*new(allocate_child())
PreOrderTask(child, visitorPre(child, myData), visitorPre, visitorPost,
PreOrderTask(child, childData, visitorPre, visitorPost,
problemSizeThreshold, overThreshold));
}