The Gaudi Framework
v30r3 (a5ef0a68)
|
Class for a generic serial queue of tasks (modeled on the Intel Threading Building Blocks Design Pattern "Local Serializer"). More...
#include <GaudiKernel/SerialTaskQueue.h>
Classes | |
class | SerialWorkItem |
Wrapper for the WorkItem class for internal concurrency bookkeeping. More... | |
class | SerialWorkItemRunner |
Helper class to wrap a SerialWorkItem in a tbb::task. More... | |
class | WorkItem |
Base class for the task to be executed by the serial queue. More... | |
Public Member Functions | |
SerialTaskQueue () | |
Default constructor. More... | |
virtual | ~SerialTaskQueue () |
Block until all the enqueued tasks are completed. More... | |
void | add (WorkItem *item) |
Enqueue a WorkItem for execution. More... | |
void | noteCompletion () |
Method used by the tasks to trigger the execution of the next task in the queue. More... | |
void | wait () const |
Block until all the currently enqueued tasks are completed. More... | |
Private Member Functions | |
void | i_startNextItem () |
Private Attributes | |
std::atomic< int > | m_count |
Counter of the currently running tasks. More... | |
tbb::concurrent_queue< SerialWorkItem * > | m_queue |
Queue of the tasks to be executed. More... | |
Class for a generic serial queue of tasks (modeled on the Intel Threading Building Blocks Design Pattern "Local Serializer").
Users of SerialTaskQueue must define the tasks to be executed specializing the class SerialTaskQueue::WorkItem, implementing the method WorkItem::run().
Tasks are enqueued via the method SerialTaskQueue::add(WorkItem*).
When the instance goes out of scope (or is destructed), the thread blocks until all the enqueued tasks are completed.
Definition at line 33 of file SerialTaskQueue.h.
Gaudi::SerialTaskQueue::SerialTaskQueue | ( | ) |
Default constructor.
Definition at line 13 of file SerialTaskQueue.cpp.
|
virtual |
Block until all the enqueued tasks are completed.
Definition at line 15 of file SerialTaskQueue.cpp.
void Gaudi::SerialTaskQueue::add | ( | WorkItem * | item | ) |
Enqueue a WorkItem for execution.
Definition at line 19 of file SerialTaskQueue.cpp.
|
private |
Definition at line 37 of file SerialTaskQueue.cpp.
void Gaudi::SerialTaskQueue::noteCompletion | ( | ) |
Method used by the tasks to trigger the execution of the next task in the queue.
Definition at line 25 of file SerialTaskQueue.cpp.
void Gaudi::SerialTaskQueue::wait | ( | ) | const |
Block until all the currently enqueued tasks are completed.
Definition at line 30 of file SerialTaskQueue.cpp.
|
private |
Counter of the currently running tasks.
Definition at line 105 of file SerialTaskQueue.h.
|
private |
Queue of the tasks to be executed.
Definition at line 107 of file SerialTaskQueue.h.