Kanzi  3.9.7
Java API
TaskDispatcher Class Reference

Task dispatcher. More...

Classes

interface  Task
 A task that can be added for execution by Task Dispatcher. More...
 

Public Member Functions

boolean isEmpty ()
 Indicates whether the task dispatcher does not contain pending tasks. More...
 
boolean isQuitting ()
 Indicates whether the task dispatcher is quitting. More...
 
void submit (Task task)
 Submits a task. More...
 

Detailed Description

Task dispatcher.

Use TaskDispatcher to schedule execution of callbacks to the Kanzi UI thread. You can access a Kanzi UI object only on the same thread where you create object. You can wrap code that accesses UI objects with tasks and submit them to the TaskDispatcher from any thread. The UI thread executes these tasks during its main loop.

Member Function Documentation

boolean isEmpty ( )

Indicates whether the task dispatcher does not contain pending tasks.

Returns
If the task queue is empty, returns true. If there are tasks in the queue, returns false.
boolean isQuitting ( )

Indicates whether the task dispatcher is quitting.

This flag is set before the emptying of the task queue begins.

Returns
If task dispatcher is quitting, returns true.
void submit ( Task  task)

Submits a task.

When you call the submit function, you dispatch a task that Kanzi executes on the same UI thread to which this task dispatcher belongs. You can call this function from any thread.

Parameters
taskThe task that you want to submit.