#include <SerialTaskQueueChain.h>
|
template<typename T > |
void | actionToRun (T &&iAction) |
|
template<typename T > |
void | passDownChain (unsigned int iIndex, tbb::task_group &iGroup, T &&iAction) |
|
Definition at line 32 of file SerialTaskQueueChain.h.
edm::SerialTaskQueueChain::SerialTaskQueueChain |
( |
| ) |
|
|
inline |
edm::SerialTaskQueueChain::SerialTaskQueueChain |
( |
std::vector< std::shared_ptr< SerialTaskQueue >> |
iQueues | ) |
|
|
inlineexplicit |
Definition at line 40 of file SerialTaskQueueChain.h.
std::vector< std::shared_ptr< SerialTaskQueue > > m_queues
std::atomic< unsigned long > m_outstandingTasks
template<typename T >
void SerialTaskQueueChain::actionToRun |
( |
T && |
iAction | ) |
|
|
private |
Definition at line 101 of file SerialTaskQueueChain.h.
Referenced by passDownChain(), and push().
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);
std::size_t edm::SerialTaskQueueChain::numberOfQueues |
( |
| ) |
const |
|
inline |
unsigned long edm::SerialTaskQueueChain::outstandingTasks |
( |
| ) |
const |
|
inline |
template<typename T >
void SerialTaskQueueChain::passDownChain |
( |
unsigned int |
iIndex, |
|
|
tbb::task_group & |
iGroup, |
|
|
T && |
iAction |
|
) |
| |
|
private |
Definition at line 86 of file SerialTaskQueueChain.h.
References actionToRun(), and m_queues.
Referenced by push().
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); });
std::vector< std::shared_ptr< SerialTaskQueue > > m_queues
void passDownChain(unsigned int iIndex, tbb::task_group &iGroup, T &&iAction)
void actionToRun(T &&iAction)
template<typename T >
void SerialTaskQueueChain::push |
( |
tbb::task_group & |
iGroup, |
|
|
T && |
iAction |
|
) |
| |
asynchronously pushes functor iAction into queue
The function will return immediately and iAction will either process concurrently with the calling thread or wait until the protected resource becomes available or until a CPU becomes available.
- Parameters
-
[in] | iAction | Must be a functor that takes no arguments and return no values. |
Definition at line 75 of file SerialTaskQueueChain.h.
References actionToRun(), cms::cuda::assert(), m_outstandingTasks, m_queues, and passDownChain().
Referenced by edm::EventProcessor::beginLumiAsync(), edm::EventProcessor::handleNextEventForStreamAsync(), edm::DelayedReaderInputProductResolver::prefetchAsync_(), and edm::Worker::TaskQueueAdaptor::push().
81 m_queues[0]->push(iGroup, [
this, &iGroup, iAction]()
mutable { this->
passDownChain(1, iGroup, iAction); });
std::vector< std::shared_ptr< SerialTaskQueue > > m_queues
void passDownChain(unsigned int iIndex, tbb::task_group &iGroup, T &&iAction)
std::atomic< unsigned long > m_outstandingTasks
void actionToRun(T &&iAction)
std::atomic<unsigned long> edm::SerialTaskQueueChain::m_outstandingTasks {0} |
|
private |
std::vector<std::shared_ptr<SerialTaskQueue> > edm::SerialTaskQueueChain::m_queues |
|
private |