1 #ifndef FWCore_Concurrency_SerialTaskQueueChain_h 2 #define FWCore_Concurrency_SerialTaskQueueChain_h 57 void push(oneapi::tbb::task_group& iGroup,
T&& iAction);
64 std::vector<std::shared_ptr<SerialTaskQueue>>
m_queues;
68 void passDownChain(
unsigned int iIndex, oneapi::tbb::task_group& iGroup,
T&& iAction);
81 m_queues[0]->push(iGroup, [
this, &iGroup, iAction]()
mutable { this->
passDownChain(1, iGroup, iAction); });
91 if (iQueueIndex + 1 ==
m_queues.size()) {
92 m_queues[iQueueIndex]->push(iGroup, [
this, iAction]()
mutable { this->
actionToRun(iAction); });
94 auto nextQueue = iQueueIndex + 1;
96 iGroup, [
this, nextQueue, &iGroup, iAction]()
mutable { this->
passDownChain(nextQueue, iGroup, iAction); });
100 template <
typename T>
103 using Queues = std::vector<std::shared_ptr<SerialTaskQueue>>;
105 auto& vec = iChain->m_queues;
106 for (
auto it = vec.rbegin() + 1; it != vec.rend(); ++it) {
109 --(iChain->m_outstandingTasks);
112 std::unique_ptr<SerialTaskQueueChain, decltype(sentryAction)> sentry(
this, sentryAction);
SerialTaskQueueChain & operator=(const SerialTaskQueueChain &)=delete
std::size_t numberOfQueues() const
std::vector< std::shared_ptr< SerialTaskQueue > > m_queues
void passDownChain(unsigned int iIndex, oneapi::tbb::task_group &iGroup, T &&iAction)
std::atomic< unsigned long > m_outstandingTasks
unsigned long outstandingTasks() const
SerialTaskQueueChain(SerialTaskQueueChain &&iOld)
SerialTaskQueueChain & operator=(SerialTaskQueueChain &&iOld)
SerialTaskQueueChain(std::vector< std::shared_ptr< SerialTaskQueue >> iQueues)
void actionToRun(T &&iAction)
void push(oneapi::tbb::task_group &iGroup, T &&iAction)
asynchronously pushes functor iAction into queue