1 #ifndef FWCore_Concurrency_LimitedTaskQueue_h
2 #define FWCore_Concurrency_LimitedTaskQueue_h
55 void push(oneapi::tbb::task_group& iGroup,
T&& iAction);
81 iOther.m_queue =
nullptr;
104 template <
typename T>
105 void pushAndPause(oneapi::tbb::task_group& iGroup,
T&& iAction);
114 template <
typename T>
116 auto set_to_run = std::make_shared<std::atomic<bool>>(
false);
118 q.push(iGroup, [set_to_run, iAction]()
mutable {
119 bool expected =
false;
120 if (set_to_run->compare_exchange_strong(expected,
true)) {
127 template <
typename T>
129 auto set_to_run = std::make_shared<std::atomic<bool>>(
false);
131 q.push(iGroup, [&
q, set_to_run, iAction]()
mutable {
132 bool expected =
false;
133 if (set_to_run->compare_exchange_strong(expected,
true)) {
void push(oneapi::tbb::task_group &iGroup, T &&iAction)
asynchronously pushes functor iAction into queue
Resumer(Resumer const &iOther)
unsigned int concurrencyLimit() const
const LimitedTaskQueue & operator=(const LimitedTaskQueue &)=delete
Resumer(Resumer &&iOther)
bool resume()
Resumes processing if the queue was paused.
std::vector< SerialTaskQueue > m_queues
SerialTaskQueue * m_queue
void pushAndPause(oneapi::tbb::task_group &iGroup, T &&iAction)
asynchronously pushes functor iAction into queue then pause the queue and run iAction ...
Resumer & operator=(Resumer &&iOther)
LimitedTaskQueue(unsigned int iLimit)
Resumer & operator=(Resumer const &iOther)
Resumer(SerialTaskQueue *iQueue)
bool pause()
Pauses processing of additional tasks from the queue.