static void _ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, void *data) { Ecore_Timer *t2; timers_added = 1; timer->at = at; timer->in = in; timer->func = func; timer->data = data; timer->just_added = 1; timer->frozen = 0; timer->pending = 0.0; if (timers) { EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(timers), t2) { if (timer->at > t2->at) { timers = (Ecore_Timer *) eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2)); return; } } } timers = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); }
EAPI void ecore_timer_freeze(Ecore_Timer *timer) { double now; if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) { ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, "ecore_timer_freeze"); return ; } /* Timer already frozen */ if (timer->frozen) return ; timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); suspended = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); now = ecore_time_get(); timer->pending = timer->at - now; timer->at = 0.0; timer->frozen = 1; }
/** * Add a new node before the given relative item in list. * * @note this code is meant to be fast: appends are O(1) and do not * walk @a list. * * @note @a new_l is considered to be in no list. If it was in another * list before, eina_inlist_remove() it before adding. No * check of @a new_l prev and next pointers is done, so it's safe * to have them uninitialized. * * @note @a relative is considered to be inside @a list, no checks are * done to confirm that and giving nodes from different lists * will lead to problems. Giving NULL @a relative is the same as * eina_list_prepend(). * * @param list existing list head or NULL to create a new list. * @param new_l new list node, must not be NULL. * @param relative reference node, @a new_l will be added before it. * * @return the new list head. Use it and not @a list anymore. */ EAPI Eina_Inlist * eina_inlist_prepend_relative(Eina_Inlist *list, Eina_Inlist *new_l, Eina_Inlist *relative) { EINA_SAFETY_ON_NULL_RETURN_VAL(new_l, list); if (relative) { new_l->prev = relative->prev; new_l->next = relative; relative->prev = new_l; if (new_l->prev) { new_l->prev->next = new_l; /* new_l->next could not be NULL, as it was set to 'relative' */ assert(new_l->next); return list; } else { /* new_l->next could not be NULL, as it was set to 'relative' */ assert(new_l->next); new_l->last = list->last; list->last = NULL; return new_l; } } return eina_inlist_prepend(list, new_l); }
static void _evas_cache_engine_image_make_dirty(Evas_Cache_Engine_Image *cache, Engine_Image_Entry *eim) { eim->flags.cached = 1; eim->flags.dirty = 1; eim->flags.loaded = 1; eim->flags.activ = 0; cache->dirty = eina_inlist_prepend(cache->dirty, EINA_INLIST_GET(eim)); }
EOLIAN static void _ecore_idle_enterer_before_constructor(Eo *obj, Ecore_Idle_Enterer_Data *ie, Ecore_Task_Cb func, const void *data) { _ecore_lock(); if (!_ecore_idle_enterer_add(obj, ie, func, data)) goto unlock; idle_enterers = (Ecore_Idle_Enterer_Data *)eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); unlock: _ecore_unlock(); }
static void _evas_cache_engine_image_make_inactive(Evas_Cache_Engine_Image *cache, Engine_Image_Entry *eim, const char *key) { eim->flags.cached = 1; eim->flags.dirty = 0; eim->flags.activ = 0; eina_hash_add(cache->inactiv, key, eim); cache->lru = eina_inlist_prepend(cache->lru, EINA_INLIST_GET(eim)); cache->usage += cache->func.mem_size_get(eim); }
/** * Add an idle enterer handler at the start of the list so it gets called earlier than others. * @param func The function to call when entering an idle state. * @param data The data to be passed to the @p func call * @return A handle to the idle enterer callback if successful. Otherwise, * NULL is returned. */ EAPI Ecore_Idle_Enterer * ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data) { Ecore_Idle_Enterer *ie; if (!func) return NULL; ie = calloc(1, sizeof(Ecore_Idle_Enterer)); if (!ie) return NULL; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); ie->func = func; ie->data = (void *)data; idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); return ie; }
/** * Add an idle enterer handler at the start of the list so it gets called earlier than others. * @param func The function to call when entering an idle state. * @param data The data to be passed to the @p func call * @return A handle to the idle enterer callback if successful. Otherwise, * NULL is returned. * @note The function func will be called every time the main loop is entering * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0 * (or ECORE_CALLBACK_CANCEL) deletes the idle enterer. */ EAPI Ecore_Idle_Enterer * ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data) { Ecore_Idle_Enterer *ie = NULL; _ecore_lock(); if (!func) goto unlock; ie = ecore_idle_enterer_calloc(1); if (!ie) goto unlock; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); ie->func = func; ie->data = (void *)data; idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); unlock: _ecore_unlock(); return ie; }