You are here: Threading API
The Threading API uses
voltmx Namespace and the following API elements.
|Provides apps with multithreading capabilities.
Create a Main thread or a UI thread using thevoltmx.runOnMainThread function to run all the operations that involve interaction with the UI. The Worker thread can be created using the voltmx.runOnWorkerThread function to run all the background tasks in parallel with the main thread. For example, Garbage collection thread is a worker thread that runs in the background to clear all the unused data in an application.
Guidelines for using Threading API
To use Threading APIs in Volt MX Iris, follow the guidelines:
- Threading APIs natively support multi-threading environment.
- An application can be composed of multiple concurrent threads.
- The UI or main thread is responsible for dispatching events to the user interface widgets and drawing the elements of the UI.
- Do not block the UI thread. Performing long operations, like network access or database queries on the UI thread, will block the user interface.
- Do not access the UI components from outside the UI thread.
- Operations that update the UI are posted on to the Main or UI thread.