8 #ifndef SERIALTASKQUEUE_H_ 9 #define SERIALTASKQUEUE_H_ 14 #include <tbb/concurrent_queue.h> 43 virtual void run() = 0;
107 tbb::concurrent_queue<SerialWorkItem*>
m_queue;
std::unique_ptr< WorkItem > m_item
Pointer to the WorkItem to run.
void run()
Execute the WorkItem and notify the SerialTaskQueue of the completion.
SerialWorkItem(WorkItem *item, SerialTaskQueue *serializer)
Initialize the instance from the WorkiItem and the SerialTaskQueue (for synchronization).
Base class for the task to be executed by the serial queue.
Class for a generic serial queue of tasks (modeled on the Intel Threading Building Blocks Design Patt...
tbb::concurrent_queue< SerialWorkItem * > m_queue
Queue of the tasks to be executed.
Wrapper for the WorkItem class for internal concurrency bookkeeping.
void wait() const
Block until all the currently enqueued tasks are completed.
SerialTaskQueue()
Default constructor.
virtual ~SerialTaskQueue()
Block until all the enqueued tasks are completed.
virtual void run()=0
Method to be implemented by the actual task classes.
SerialWorkItemRunner(SerialWorkItem *item)
Initialize the instance.
void add(WorkItem *item)
Enqueue a WorkItem for execution.
Helper class to wrap a SerialWorkItem in a tbb::task.
void noteCompletion()
Method used by the tasks to trigger the execution of the next task in the queue.
tbb::task * execute() override
Call the run method of the work item.
SerialWorkItem * m_item
Pointer to the work item to be executed.
SerialTaskQueue * m_serializer
Pointer to the SerialTaskQueue used for the synchronization.
Helper functions to set/get the application return code.
std::atomic< int > m_count
Counter of the currently running tasks.