1 #ifndef FWCore_Concurrency_SerialTaskQueueChain_h
2 #define FWCore_Concurrency_SerialTaskQueueChain_h
57 void push(
T&& iAction);
75 std::vector<std::shared_ptr<SerialTaskQueue>>
m_queues;
98 auto destry = [](
tbb::task* iTask) { tbb::task::destroy(*iTask); };
101 waitTask->set_ref_count(3);
103 std::exception_ptr ptr;
104 auto waitTaskPtr = waitTask.get();
105 push([waitTaskPtr, iAction, &ptr]() {
107 auto dec = [](
tbb::task* iTask) { iTask->decrement_ref_count(); };
111 ptr = std::current_exception();
115 waitTask->decrement_ref_count();
116 waitTask->wait_for_all();
119 std::rethrow_exception(ptr);
123 template <
typename T>
129 if (iQueueIndex + 1 ==
m_queues.size()) {
132 auto nextQueue = iQueueIndex + 1;
133 m_queues[iQueueIndex]->push([
this, nextQueue, iAction]()
mutable { this->
passDownChain(nextQueue, iAction); });
137 template <
typename T>
140 using Queues = std::vector<std::shared_ptr<SerialTaskQueue>>;
142 auto& vec = iChain->m_queues;
143 for (
auto it = vec.rbegin() + 1; it != vec.rend(); ++it) {
146 --(iChain->m_outstandingTasks);