Base class for TaskDispatcher implementation. More...
#include <kanzi/core.ui/platform/task_dispatcher/common/task_dispatcher_base.hpp>
Public Types | |
typedef function< void()> | Task |
Task is a callback that is dispatched by TaskDispatcher and executed on a specific UI thread. More... | |
Public Member Functions | |
void | cleanUpTasks () |
Clean up tasks until no tasks remain. More... | |
size_t | executeTasks () |
Executes the tasks that have been dispatched to the UI thread. More... | |
bool | isQuitting () const |
Indicates whether the task dispatcher is quitting. More... | |
virtual void | notifyTasksAvailable ()=0 |
Notifies this class that tasks are available. More... | |
virtual void | notifyTasksConsumed ()=0 |
Notifies this class that tasks have been consumed. More... | |
void | setDomain (Domain *domain) |
Setter for domain. More... | |
void | setQuitting (bool flag) |
Set the quitting flag state. More... | |
void | submit (Task task) |
Submits a task. More... | |
Protected Member Functions | |
TaskDispatcherBase () | |
Constructor. More... | |
virtual | ~TaskDispatcherBase () |
Destructor. More... | |
Base class for TaskDispatcher implementation.
typedef function<void()> kanzi::TaskDispatcherBase::Task |
Task is a callback that is dispatched by TaskDispatcher and executed on a specific UI thread.
|
explicitprotected |
Constructor.
|
protectedvirtual |
Destructor.
void kanzi::TaskDispatcherBase::submit | ( | Task | task | ) |
Submits a task.
The task will be dispatched to and executed on the UI thread that this task dispatcher belongs to. You can call this function from any thread.
size_t kanzi::TaskDispatcherBase::executeTasks | ( | ) |
Executes the tasks that have been dispatched to the UI thread.
Kanzi calls this function automatically. This function can only be called from the UI thread that this dispatcher belongs to. Tasks will be removed after execution. New tasks added during the execution will not be executed.
void kanzi::TaskDispatcherBase::cleanUpTasks | ( | ) |
Clean up tasks until no tasks remain.
Sets the quitting flag, that the tasks can use to check if new tasks should be posted.
|
pure virtual |
Notifies this class that tasks are available.
This is an internal function.
Implemented in kanzi::TaskDispatcher.
|
pure virtual |
Notifies this class that tasks have been consumed.
This is an internal function.
Implemented in kanzi::TaskDispatcher.
void kanzi::TaskDispatcherBase::setDomain | ( | Domain * | domain | ) |
Setter for domain.
domain | Pointer to domain |
bool kanzi::TaskDispatcherBase::isQuitting | ( | ) | const |
Indicates whether the task dispatcher is quitting.
This flag is set before the emptying of the task queue begins.
void kanzi::TaskDispatcherBase::setQuitting | ( | bool | flag | ) |
Set the quitting flag state.
Called by the system before emptying the task dispatcher.
flag | New quitting flag state. |