#include <Serializer.h>
Public Member Functions | |
Serializer (bool immediate=true) | |
Start a serializer. | |
void | execute (Task &task) |
Task may be executed immediately in the calling thread if there are no other tasks pending or executing and the "immediate" paramater to the constructor was true. | |
void | dispatch () |
Execute pending tasks sequentially in calling thread. |
Task is a void returning 0-arg functor. It must not throw exceptions.
Note we deliberately do not use boost::function as the task type because copying a boost::functor allocates the target object on the heap.
qpid::sys::Serializer< Task >::Serializer | ( | bool | immediate = true |
) | [inline] |
Start a serializer.
immediate | Allow execute() to execute a task immediatly in the current thread. |
void qpid::sys::Serializer< Task >::execute | ( | Task & | task | ) | [inline] |
Task may be executed immediately in the calling thread if there are no other tasks pending or executing and the "immediate" paramater to the constructor was true.
Otherwise task will be enqueued for execution by a dispatch thread.
References qpid::sys::Serializer< Task >::dispatch(), qpid::sys::SerializerBase::DISPATCHING, qpid::sys::SerializerBase::EXECUTING, qpid::sys::SerializerBase::IDLE, and qpid::sys::SerializerBase::SHUTDOWN.
void qpid::sys::Serializer< Task >::dispatch | ( | ) | [inline, virtual] |
Execute pending tasks sequentially in calling thread.
Drains the task queue and returns, does not block for more tasks.
ShutdownException | if the serializer is being destroyed. |
Implements qpid::sys::SerializerBase.
References qpid::sys::SerializerBase::DISPATCHING, qpid::sys::SerializerBase::IDLE, and qpid::sys::SerializerBase::SHUTDOWN.
Referenced by qpid::sys::Serializer< Task >::execute().