Mobile native Wearable native

Core Loop and OS Interfacing: Handling the Main Loop and Threads

The Ecore library provides convenience functions, which allow you to manage the application main loop and threading.

Tizen applications developed with EFL use the EDA (Event-driven Architecture) pattern. In EDA, applications reiterate the routine that checks input events, processes the events, and then displays the outputs. The main loop is the entity handling this sequence. It is the heart of any GUI based on EDA.

Most applications start and end the main loop, which is used in special situations, such as propagation of events to UI components for handling and updating application appearance and state. That guarantees the delivery of all events received from low-level input devices and provides the accurate and speedy render event loop for synchronizing the application UI with events.

The Ecore library provides main loop abstraction with a clean and tiny event loop library. Applications mainly deal with file descriptors handling, event handling, and timer handling from the beginning of the main loop.

In addition, Ecore provides several modules related to, for example, Audio, Cocoa, Connection, Drm, FrameBuffer, Input, IPC, Wayland, Win32, and X11 with convenient methods to communicate with underlying operating systems, such as Ubuntu, Windows®, or Mac OS® X.

There are 2 types of threads in Tizen applications:

  • Main thread that contains the main loop
  • Worker threads that support concurrent processing. In parallel processing, applications must keep the GUI updating while processing the data related to the UI.

The Ecore library provides these concurrent processing mechanisms through Ecore threads. An Ecore thread is not a simple wrapper for standard POSIX threads. It is not meant to be used to run parallel tasks throughout the entire duration of the application, especially when these tasks are performance-critical. Ecore manages these tasks using a pool of threads based on system configuration, such as the number of processors the system has, and the maximum amount of concurrent threads set for the application.

Note
Except as noted, this content is licensed under LGPLv2.1+.
Go to top