diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index 0c19d4b482..26a7481d49 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -87,10 +87,6 @@ struct _Ecore_Safe_Call Eina_Bool suspend : 1; }; -#ifdef HAVE_SYSTEMD -static Eina_Bool _systemd_watchdog_cb(void *data); -#endif - static void _ecore_main_loop_thread_safe_call(Ecore_Safe_Call *order); static void _thread_safe_cleanup(void *data); static void _thread_callback(void *data, @@ -116,7 +112,9 @@ static Ecore_Power_State _ecore_power_state = ECORE_POWER_STATE_MAINS; static Ecore_Memory_State _ecore_memory_state = ECORE_MEMORY_STATE_NORMAL; #ifdef HAVE_SYSTEMD -static Ecore_Timer *_systemd_watchdog = NULL; +static void _systemd_watchdog_cb(void *data, const Efl_Event *event); + +static Efl_Loop_Timer *_systemd_watchdog = NULL; #endif static Efl_Vpath *vpath = NULL; @@ -324,12 +322,17 @@ ecore_init(void) sec = ((double) atoi(getenv("WATCHDOG_USEC"))) / 1000 / 1000; - _systemd_watchdog = ecore_timer_add(sec / 2, _systemd_watchdog_cb, NULL); + _systemd_watchdog = + efl_add(EFL_LOOP_TIMER_CLASS, ecore_main_loop_get(), + efl_loop_timer_interval_set(efl_added, sec / 2), + efl_event_callback_add(efl_added, + EFL_LOOP_TIMER_EVENT_TICK, + _systemd_watchdog_cb, NULL)); unsetenv("WATCHDOG_USEC"); INF("Setup systemd watchdog to : %f", sec); - _systemd_watchdog_cb(NULL); + _systemd_watchdog_cb(NULL, NULL); } #endif @@ -399,7 +402,7 @@ ecore_shutdown(void) #ifdef HAVE_SYSTEMD if (_systemd_watchdog) { - ecore_timer_del(_systemd_watchdog); + efl_del(_systemd_watchdog); _systemd_watchdog = NULL; } #endif @@ -959,11 +962,10 @@ _ecore_fps_debug_runtime_add(double t) } #ifdef HAVE_SYSTEMD -static Eina_Bool -_systemd_watchdog_cb(EINA_UNUSED void *data) +static void +_systemd_watchdog_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) { sd_notify(0, "WATCHDOG=1"); - return ECORE_CALLBACK_RENEW; } #endif diff --git a/src/lib/ecore/ecore_exe_posix.c b/src/lib/ecore/ecore_exe_posix.c index 21d8861ef2..2d8fa98983 100644 --- a/src/lib/ecore/ecore_exe_posix.c +++ b/src/lib/ecore/ecore_exe_posix.c @@ -889,7 +889,7 @@ _impl_ecore_exe_hup(Ecore_Exe *obj EINA_UNUSED, Ecore_Exe_Data *exe) } static void -_ecore_exe_make_sure_its_dead(void *data, const Efl_Event *event EINA_UNUSED) +_ecore_exe_make_sure_its_dead(void *data, const Efl_Event *event) { Eo *exe_obj = data; Ecore_Exe_Data *exe = efl_data_scope_get(exe_obj, MY_CLASS); @@ -907,10 +907,11 @@ _ecore_exe_make_sure_its_dead(void *data, const Efl_Event *event EINA_UNUSED) efl_loop_timer_interval_set(efl_added, 10.0)); kill(exe->pid, SIGKILL); } + efl_del(event->object); } static void -_ecore_exe_make_sure_its_really_dead(void *data, const Efl_Event *event EINA_UNUSED) +_ecore_exe_make_sure_its_really_dead(void *data, const Efl_Event *event) { Eo *exe_obj = data; Ecore_Exe_Data *exe = efl_data_scope_get(exe_obj, MY_CLASS); @@ -923,9 +924,10 @@ _ecore_exe_make_sure_its_really_dead(void *data, const Efl_Event *event EINA_UNU INF("PID %d is not really dead.", exe->pid); exe->doomsday_clock = NULL; } + efl_del(event->object); } -Ecore_Timer * +Efl_Loop_Timer * _ecore_exe_doomsday_clock_get(Ecore_Exe *obj) { Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS); @@ -934,8 +936,7 @@ _ecore_exe_doomsday_clock_get(Ecore_Exe *obj) } void -_ecore_exe_doomsday_clock_set(Ecore_Exe *obj, - Ecore_Timer *dc) +_ecore_exe_doomsday_clock_set(Ecore_Exe *obj, Efl_Loop_Timer *dc) { Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS); if (!exe) return; diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h index 2d65477bb7..9c0d5f3dc7 100644 --- a/src/lib/ecore/ecore_private.h +++ b/src/lib/ecore/ecore_private.h @@ -108,9 +108,9 @@ struct _Efl_Loop_Data double loop_time; Eina_Hash *providers; - Ecore_Timer *poll_high; - Ecore_Timer *poll_medium; - Ecore_Timer *poll_low; + Efl_Loop_Timer *poll_high; + Efl_Loop_Timer *poll_medium; + Efl_Loop_Timer *poll_low; Eina_List *exes; // only used in main loop (for now?) @@ -261,9 +261,8 @@ Ecore_Event *_ecore_event_add(int type, void *data); void _ecore_event_call(void); -Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe); -void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, - Ecore_Timer *dc); +Efl_Loop_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe); +void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, Efl_Loop_Timer *dc); void *_ecore_event_signal_user_new(void); void *_ecore_event_signal_hup_new(void); diff --git a/src/lib/ecore/ecore_signal.c b/src/lib/ecore/ecore_signal.c index 450342a2c7..3d743a21cd 100644 --- a/src/lib/ecore/ecore_signal.c +++ b/src/lib/ecore/ecore_signal.c @@ -52,7 +52,7 @@ static void _ecore_signal_callback_sigpwr(int sig, void *foo); #endif -static Eina_Bool _ecore_signal_exe_exit_delay(void *data); +static void _ecore_signal_exe_exit_delay(void *data, const Efl_Event *event); //#define MAXSIGQ 256 // 32k #define MAXSIGQ 64 // 8k @@ -162,7 +162,7 @@ _ecore_signal_generic_free(void *data EINA_UNUSED, void *event) } void -_ecore_signal_call(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED) +_ecore_signal_call(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED) { volatile sig_atomic_t n; sigset_t oldset, newset; @@ -258,12 +258,15 @@ _ecore_signal_call(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED) * check to see for Last Words, and only delay if there are any. * This has it's own set of problems. */ - Ecore_Timer *doomsday_clock; - - doomsday_clock = _ecore_exe_doomsday_clock_get(e->exe); - IF_FN_DEL(ecore_timer_del, doomsday_clock); - doomsday_clock = ecore_timer_add - (0.1, _ecore_signal_exe_exit_delay, e); + Efl_Loop_Timer *doomsday_clock = + _ecore_exe_doomsday_clock_get(e->exe); + efl_del(doomsday_clock); + doomsday_clock = + efl_add(EFL_LOOP_TIMER_CLASS, obj, + efl_loop_timer_interval_set(efl_added, 0.1), + efl_event_callback_add + (efl_added, EFL_LOOP_TIMER_EVENT_TICK, + _ecore_signal_exe_exit_delay, e)); _ecore_exe_doomsday_clock_set(e->exe, doomsday_clock); } else @@ -601,18 +604,15 @@ _ecore_signal_callback_sigpwr(int sig EINA_UNUSED, #endif -static Eina_Bool -_ecore_signal_exe_exit_delay(void *data) +static void +_ecore_signal_exe_exit_delay(void *data, const Efl_Event *event) { - Ecore_Exe_Event_Del *e; + Ecore_Exe_Event_Del *e = data; - e = data; - if (e) - { - _ecore_exe_doomsday_clock_set(e->exe, NULL); - ecore_event_add(ECORE_EXE_EVENT_DEL, e, - _ecore_exe_event_del_free, NULL); - } - return ECORE_CALLBACK_CANCEL; + if (!e) return; + _ecore_exe_doomsday_clock_set(e->exe, NULL); + ecore_event_add(ECORE_EXE_EVENT_DEL, e, + _ecore_exe_event_del_free, NULL); + efl_del(event->object); } diff --git a/src/lib/ecore/efl_loop.c b/src/lib/ecore/efl_loop.c index 79509703b2..6cf133f981 100644 --- a/src/lib/ecore/efl_loop.c +++ b/src/lib/ecore/efl_loop.c @@ -19,7 +19,7 @@ typedef struct _Efl_Internal_Promise Efl_Internal_Promise; struct _Efl_Loop_Promise_Simple_Data { union { - Ecore_Timer *timer; + Efl_Loop_Timer *timer; Ecore_Idler *idler; }; Eina_Promise *promise; @@ -265,7 +265,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event) --pd->pollers.high; if (!pd->pollers.high) { - ecore_timer_del(pd->poll_high); + efl_del(pd->poll_high); pd->poll_high = NULL; } } @@ -274,7 +274,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event) --pd->pollers.medium; if (!pd->pollers.medium) { - ecore_timer_del(pd->poll_medium); + efl_del(pd->poll_medium); pd->poll_medium = NULL; } } @@ -283,7 +283,7 @@ _check_event_catcher_del(void *data, const Efl_Event *event) --pd->pollers.low; if (!pd->pollers.low) { - ecore_timer_del(pd->poll_low); + efl_del(pd->poll_low); pd->poll_low = NULL; } } @@ -504,21 +504,24 @@ static void _efl_loop_timeout_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED) { Efl_Loop_Promise_Simple_Data *d = data; - ecore_timer_del(d->timer); + efl_del(d->timer); + d->timer = NULL; efl_loop_promise_simple_data_mp_free(d); } -static Eina_Bool -_efl_loop_timeout_done(void *data) +static void +_efl_loop_timeout_done(void *data, const Efl_Event *event) { Efl_Loop_Promise_Simple_Data *d = data; + eina_promise_resolve(d->promise, EINA_VALUE_EMPTY); + d->timer = NULL; efl_loop_promise_simple_data_mp_free(d); - return EINA_FALSE; + efl_del(event->object); } static Eina_Future * -_efl_loop_timeout(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, double time) +_efl_loop_timeout(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, double tim) { Efl_Loop_Promise_Simple_Data *d; Eina_Promise *p; @@ -526,7 +529,11 @@ _efl_loop_timeout(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, double time) d = efl_loop_promise_simple_data_calloc(1); EINA_SAFETY_ON_NULL_RETURN_VAL(d, NULL); - d->timer = ecore_timer_add(time, _efl_loop_timeout_done, d); + d->timer = efl_add(EFL_LOOP_TIMER_CLASS, obj, + efl_loop_timer_interval_set(efl_added, tim), + efl_event_callback_add(efl_added, + EFL_LOOP_TIMER_EVENT_TICK, + _efl_loop_timeout_done, d)); EINA_SAFETY_ON_NULL_GOTO(d->timer, timer_error); p = eina_promise_new(efl_loop_future_scheduler_get(obj),