The idler functionality in Ecore allows for callbacks to be called when the program isn't handling events, timers or fd handlers. More...
Typedefs | |
typedef Eo | Ecore_Idler |
A handle for idlers. | |
typedef Eo | Ecore_Idle_Enterer |
A handle for idle enterers. | |
typedef Eo | Ecore_Idle_Exiter |
A handle for idle exiters. | |
Functions | |
static Eina_Bool | _ecore_idle_enterer_add (Ecore_Idle_Enterer *obj, Ecore_Idle_Enterer_Private_Data *ie, Ecore_Task_Cb func, const void *data) |
EAPI Ecore_Idle_Enterer * | ecore_idle_enterer_add (Ecore_Task_Cb func, const void *data) |
Add an idle enterer handler. More... | |
static void | _idle_enterer_after_constructor (Eo *obj, void *_pd, va_list *list) |
EAPI Ecore_Idle_Enterer * | ecore_idle_enterer_before_add (Ecore_Task_Cb func, const void *data) |
Add an idle enterer handler at the start of the list so it gets called earlier than others. More... | |
static void | _idle_enterer_before_constructor (Eo *obj, void *_pd, va_list *list) |
static void | _constructor (Eo *obj, void *_pd, va_list *list) |
EAPI void * | ecore_idle_enterer_del (Ecore_Idle_Enterer *idle_enterer) |
Delete an idle enterer callback. More... | |
EAPI Ecore_Idle_Exiter * | ecore_idle_exiter_add (Ecore_Task_Cb func, const void *data) |
Add an idle exiter handler. More... | |
static void | _idle_exiter_constructor (Eo *obj, void *_pd, va_list *list) |
EAPI void * | ecore_idle_exiter_del (Ecore_Idle_Exiter *idle_exiter) |
Delete an idle exiter handler from the list to be run on exiting idle state. More... | |
const Eo_Class * | ecore_idler_class_get (void) |
const Eo_Class * | ecore_idle_enterer_class_get (void) |
const Eo_Class * | ecore_idle_exiter_class_get (void) |
#define | ECORE_IDLER_CLASS ecore_idler_class_get() |
#define | ECORE_IDLER_ID(sub_id) (ECORE_IDLER_BASE_ID + sub_id) |
#define | ecore_idler_constructor(func, data) ECORE_IDLER_ID(ECORE_IDLER_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
#define | ECORE_IDLE_ENTERER_CLASS ecore_idle_enterer_class_get() |
#define | ECORE_IDLE_ENTERER_ID(sub_id) (ECORE_IDLE_ENTERER_BASE_ID + sub_id) |
#define | ecore_idle_enterer_after_constructor(func, data) ECORE_IDLE_ENTERER_ID(ECORE_IDLE_ENTERER_SUB_ID_AFTER_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
#define | ecore_idle_enterer_before_constructor(func, data) ECORE_IDLE_ENTERER_ID(ECORE_IDLE_ENTERER_SUB_ID_BEFORE_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
#define | ECORE_IDLE_EXITER_CLASS ecore_idle_exiter_class_get() |
#define | ECORE_IDLE_EXITER_ID(sub_id) (ECORE_IDLE_EXITER_BASE_ID + sub_id) |
#define | ecore_idle_exiter_constructor(func, data) ECORE_IDLE_EXITER_ID(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
enum | { ECORE_IDLER_SUB_ID_CONSTRUCTOR, ECORE_IDLER_SUB_ID_LAST } |
enum | { ECORE_IDLE_ENTERER_SUB_ID_AFTER_CONSTRUCTOR, ECORE_IDLE_ENTERER_SUB_ID_BEFORE_CONSTRUCTOR, ECORE_IDLE_ENTERER_SUB_ID_LAST } |
enum | { ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR, ECORE_IDLE_EXITER_SUB_ID_LAST } |
Eo_Op | ECORE_IDLER_BASE_ID |
Eo_Op | ECORE_IDLE_ENTERER_BASE_ID |
Eo_Op | ECORE_IDLE_EXITER_BASE_ID |
Ecore_Idler * | ecore_idler_add (Ecore_Task_Cb func, const void *data) |
Add an idler handler. More... | |
void * | ecore_idler_del (Ecore_Idler *idler) |
Delete an idler callback from the list to be executed. More... | |
The idler functionality in Ecore allows for callbacks to be called when the program isn't handling events, timers or fd handlers.
There are three types of idlers: Enterers, Idlers(proper) and Exiters. They are called, respectively, when the program is about to enter an idle state, when the program is in an idle state and when the program has just left an idle state and will begin processing events, timers or fd handlers.
Enterer callbacks are good for updating your program's state, if it has a state engine. Once all of the enterer handlers are called, the program will enter a "sleeping" state.
Idler callbacks are called when the main loop has called all enterer handlers. They are useful for interfaces that require polling and timers would be too slow to use.
Exiter callbacks are called when the main loop wakes up from an idle state.
If no idler callbacks are specified, then the process literally goes to sleep. Otherwise, the idler callbacks are called continuously while the loop is "idle", using as much CPU as is available to the process.
Example with functions that deal with idle state:
#define ecore_idler_constructor | ( | func, | |
data | |||
) | ECORE_IDLER_ID(ECORE_IDLER_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
#define ecore_idle_enterer_after_constructor | ( | func, | |
data | |||
) | ECORE_IDLE_ENTERER_ID(ECORE_IDLE_ENTERER_SUB_ID_AFTER_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
Contructor. Will insert the handler at the end of the list.
[in] | func | |
[in] | data |
Referenced by ecore_idle_enterer_add().
#define ecore_idle_enterer_before_constructor | ( | func, | |
data | |||
) | ECORE_IDLE_ENTERER_ID(ECORE_IDLE_ENTERER_SUB_ID_BEFORE_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
Contructor. Will insert the handler at the beginning of the list.
[in] | func | |
[in] | data |
Referenced by ecore_idle_enterer_before_add().
#define ecore_idle_exiter_constructor | ( | func, | |
data | |||
) | ECORE_IDLE_EXITER_ID(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) |
EAPI Ecore_Idle_Enterer* ecore_idle_enterer_add | ( | Ecore_Task_Cb | func, |
const void * | data | ||
) |
Add an idle enterer handler.
func | The function to call when entering an idle state. |
data | The data to be passed to the func call |
References ecore_idle_enterer_after_constructor.
Referenced by ecore_evas_init(), ecore_wl_init(), and ecore_x_init().
EAPI Ecore_Idle_Enterer* ecore_idle_enterer_before_add | ( | Ecore_Task_Cb | func, |
const void * | data | ||
) |
Add an idle enterer handler at the start of the list so it gets called earlier than others.
func | The function to call when entering an idle state. |
data | The data to be passed to the func call |
References ecore_idle_enterer_before_constructor.
EAPI void* ecore_idle_enterer_del | ( | Ecore_Idle_Enterer * | idle_enterer | ) |
Delete an idle enterer callback.
idle_enterer | The idle enterer to delete |
References EINA_MAIN_LOOP_CHECK_RETURN_VAL.
Referenced by ecore_evas_shutdown().
EAPI Ecore_Idle_Exiter* ecore_idle_exiter_add | ( | Ecore_Task_Cb | func, |
const void * | data | ||
) |
Add an idle exiter handler.
func | The function to call when exiting an idle state. |
data | The data to be passed to the func call |
References ecore_idle_exiter_constructor.
EAPI void* ecore_idle_exiter_del | ( | Ecore_Idle_Exiter * | idle_exiter | ) |
Delete an idle exiter handler from the list to be run on exiting idle state.
idle_exiter | The idle exiter to delete |
References EINA_MAIN_LOOP_CHECK_RETURN_VAL.
Ecore_Idler* ecore_idler_add | ( | Ecore_Task_Cb | func, |
const void * | data | ||
) |
Add an idler handler.
func | The function to call when idling. |
data | The data to be passed to this func call. |
NULL
otherwise.Add an idler handle to the event loop, returning a handle on success and NULL
otherwise. The function func
will be called repeatedly while no other events are ready to be processed, as long as it returns 1
(or ECORE_CALLBACK_RENEW). A return of 0
(or ECORE_CALLBACK_CANCEL) deletes the idler.
Idlers are useful for progressively prossessing data without blocking.
References ecore_idler_constructor.
Referenced by eldbus_name_owner_changed_callback_add(), and eldbus_service_property_changed().
void* ecore_idler_del | ( | Ecore_Idler * | idler | ) |
Delete an idler callback from the list to be executed.
idler | The handle of the idler callback to delete |
NULL
otherwise. References EINA_MAIN_LOOP_CHECK_RETURN_VAL.
Referenced by ecore_con_url_shutdown(), eldbus_name_owner_changed_callback_del(), and eldbus_service_object_manager_attach().