1 #ifndef FWCore_Concurrency_LimitedTaskQueue_h 2 #define FWCore_Concurrency_LimitedTaskQueue_h 56 void push(
const T& iAction);
80 auto set_to_run = std::make_shared<std::atomic<bool>>(
false);
82 q.push([set_to_run,iAction]() {
83 bool expected =
false;
84 if(set_to_run->compare_exchange_strong(expected,
true)) {
93 tbb::empty_task* waitTask =
new (tbb::task::allocate_root()) tbb::empty_task;
94 waitTask->set_ref_count(2);
95 auto set_to_run = std::make_shared<std::atomic<bool>>(
false);
97 q.push([set_to_run,waitTask,iAction]() {
98 bool expected =
false;
99 if(set_to_run->compare_exchange_strong(expected,
true)) {
103 waitTask->decrement_ref_count();
107 waitTask->wait_for_all();
unsigned int concurrencyLimit() const
const LimitedTaskQueue & operator=(const LimitedTaskQueue &)=delete
std::vector< SerialTaskQueue > m_queues
void pushAndWait(const T &iAction)
synchronously pushes functor iAction into queue
LimitedTaskQueue(unsigned int iLimit)
void push(const T &iAction)
asynchronously pushes functor iAction into queue