private:
std::vector<std::shared_ptr<BaseDataType> > _inputs;
std::vector<std::shared_ptr<INode> > _nodes;
- std::vector<std::shared_ptr<std::thread> > _threads;
std::vector<std::shared_ptr<BaseResultType> > _results;
void threadCb(std::shared_ptr<INode> &node);
throw InvalidOperation("No input source.");
}
+ std::vector<std::unique_ptr<std::thread> > threads;
+
for (auto &n : _nodes) {
// Set input as source of current node.
// If no dependency then this node has to receive input source
for (auto &d : dependencies)
d->wait();
- _threads.push_back(make_shared<thread>(&TaskManager::threadCb, this, std::ref(n)));
+ threads.push_back(make_unique<thread>(&TaskManager::threadCb, this, std::ref(n)));
}
- for (auto &t : _threads)
+ for (auto &t : threads)
t->join();
_inputs.clear();
- _threads.clear();
}
vector<shared_ptr<BaseResultType> > &TaskManager::output()