From: Enlightenment S. <no-...@en...> - 2011-07-12 06:11:22
|
Log: ecore: Wake main loop immediately on zero sleep Signed-off-by: Mike McCormack <mj....@sa...> Author: mike_m Date: 2011-07-11 23:11:14 -0700 (Mon, 11 Jul 2011) New Revision: 61268 Trac: http://trac.enlightenment.org/e/changeset/61268 Modified: trunk/ecore/src/lib/ecore/ecore_main.c Modified: trunk/ecore/src/lib/ecore/ecore_main.c =================================================================== --- trunk/ecore/src/lib/ecore/ecore_main.c 2011-07-12 06:11:04 UTC (rev 61267) +++ trunk/ecore/src/lib/ecore/ecore_main.c 2011-07-12 06:11:14 UTC (rev 61268) @@ -483,7 +483,7 @@ static gboolean _ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time) { - gboolean running; + gboolean ready = FALSE; in_main_loop++; @@ -500,8 +500,7 @@ while (_ecore_signal_count_get()) _ecore_signal_call(); /* don't check fds if somebody quit */ - running = g_main_loop_is_running(ecore_main_loop); - if (running) + if (g_main_loop_is_running(ecore_main_loop)) { /* only set idling state in dispatch */ if (ecore_idling && !_ecore_idler_exist() && !_ecore_event_exist()) @@ -510,7 +509,7 @@ { int r = -1; double t = _ecore_timer_next_get(); - if (timer_fd >= 0) + if (timer_fd >= 0 && t > 0.0) { struct itimerspec ts; @@ -536,23 +535,33 @@ } } if (r == -1) - *next_time = ceil(t * 1000.0); + { + *next_time = ceil(t * 1000.0); + if (t == 0.0) + ready = TRUE; + } } else *next_time = -1; } else - *next_time = 0; + { + *next_time = 0; + if (_ecore_event_exist()) + ready = TRUE; + } if (fd_handlers_with_prep) _ecore_main_prepare_handlers(); } + else + ready = TRUE; in_main_loop--; INF("leave, timeout = %d", *next_time); /* ready if we're not running (about to quit) */ - return !running; + return ready; } static gboolean |