1 #ifndef FWCore_Concurrency_LimitedTaskQueue_h 2 #define FWCore_Concurrency_LimitedTaskQueue_h 56 void push(
const T& iAction);
79 auto set_to_run = std::make_shared<std::atomic<bool>>(
false);
81 q.push([set_to_run,iAction]() {
82 bool expected =
false;
83 if(set_to_run->compare_exchange_strong(expected,
true)) {
92 tbb::empty_task* waitTask =
new (tbb::task::allocate_root()) tbb::empty_task;
93 waitTask->set_ref_count(2);
94 auto set_to_run = std::make_shared<std::atomic<bool>>(
false);
96 q.push([set_to_run,waitTask,iAction]() {
97 bool expected =
false;
98 if(set_to_run->compare_exchange_strong(expected,
true)) {
102 waitTask->decrement_ref_count();
106 waitTask->wait_for_all();
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