/** * Add a animator to tick off at every animaton tick during main loop execution. * @param func The function to call when it ticks off * @param data The data to pass to the function * @return A handle to the new animator * @ingroup Ecore_Animator_Group * * This function adds a animator and returns its handle on success and NULL on * failure. The function @p func will be called every N seconds where N is the * frametime interval set by ecore_animator_frametime_set(). The function will * be passed the @p data pointer as its parameter. * * When the animator @p func is called, it must return a value of either 1 or 0. * If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at the * next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be deleted * automatically making any references/handles for it invalid. */ EAPI Ecore_Animator * ecore_animator_add(Ecore_Task_Cb func, const void *data) { Ecore_Animator *animator; if (!func) return NULL; animator = calloc(1, sizeof(Ecore_Animator)); if (!animator) return NULL; ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR); animator->func = func; animator->data = (void *)data; animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); if (!timer) { double t_loop = ecore_loop_time_get(); double sync_0 = 0.0; double d = -fmod(t_loop - sync_0, animators_frametime); timer = ecore_timer_loop_add(animators_frametime, _ecore_animator, NULL); ecore_timer_delay(timer, d); } return animator; }
/** * @brief Set a timeout to disconnect after no activity * @param e The #Esql object (NOT NULL) * @param timeout The timeout in seconds * * Use this function to apply a timer policy to an Esql object and force disconnection * after @p timeout seconds of inactivity. * @note Setting a value <= 0 will disable this feature. */ void esql_connect_timeout_set(Esql *e, double timeout) { EINA_SAFETY_ON_NULL_RETURN(e); e->timeout = timeout; if (e->pool) { esql_pool_connect_timeout_set((Esql_Pool*)e, timeout); return; } if (timeout > 0.0) { if (e->timeout_timer) ecore_timer_delay(e->timeout_timer, e->timeout - ecore_timer_pending_get(e->timeout_timer)); else e->timeout_timer = ecore_timer_add(timeout, (Ecore_Task_Cb)esql_timeout_cb, e); } else { ecore_timer_del(e->timeout_timer); e->timeout_timer = NULL; e->timeout = 0; } }
void Timer::delay (double add) { ecore_timer_delay (mETimer, add); }