From a48bf2f9f3acd1a845601fa172d3f78c1b935b9f Mon Sep 17 00:00:00 2001 From: raster Date: Fri, 19 Feb 2010 08:00:44 +0000 Subject: [PATCH] rfiddling wiht lop to try and get rid of pauses. i think i found it... plus a bit of streamlining. need to test more widely now. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@46303 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore/ecore_main.c | 46 ++++++++++++++++++++++++++------------------- src/lib/ecore/ecore_timer.c | 7 +------ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index 364bdf3..4dbc776 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -687,50 +687,54 @@ _ecore_main_loop_iterate_internal(int once_only) in_main_loop++; /* expire any timers */ - { - double now; + while (_ecore_timer_call(_ecore_loop_time)); + _ecore_timer_cleanup(); - now = ecore_loop_time_get(); - while (_ecore_timer_call(now)); - _ecore_timer_cleanup(); - } /* process signals into events .... */ while (_ecore_signal_count_get()) _ecore_signal_call(); if (_ecore_event_exist()) { + _ecore_idle_enterer_call(); have_event = 1; _ecore_main_select(0.0); + _ecore_loop_time = ecore_time_get(); + _ecore_timer_enable_new(); goto process_events; } /* call idle enterers ... */ - if (!once_only) - _ecore_idle_enterer_call(); + if (!once_only) _ecore_idle_enterer_call(); else { have_event = have_signal = 0; if (_ecore_main_select(0.0) > 0) have_event = 1; - if (_ecore_signal_count_get() > 0) have_signal = 1; - if (have_signal || have_event) - goto process_events; + { + _ecore_loop_time = ecore_time_get(); + _ecore_timer_enable_new(); + goto process_events; + } } /* if these calls caused any buffered events to appear - deal with them */ - while (_ecore_main_fd_handlers_buf_call()); + _ecore_main_fd_handlers_buf_call(); /* if ther are any - jump to processing them */ if (_ecore_event_exist()) { have_event = 1; _ecore_main_select(0.0); + _ecore_loop_time = ecore_time_get(); + _ecore_timer_enable_new(); goto process_events; } if (once_only) { _ecore_idle_enterer_call(); in_main_loop--; + _ecore_loop_time = ecore_time_get(); + _ecore_timer_enable_new(); return; } @@ -745,7 +749,9 @@ _ecore_main_loop_iterate_internal(int once_only) _ecore_timer_enable_new(); if (do_quit) { + _ecore_loop_time = ecore_time_get(); in_main_loop--; + _ecore_timer_enable_new(); return; } if (!_ecore_event_exist()) @@ -775,7 +781,6 @@ _ecore_main_loop_iterate_internal(int once_only) if (next_time >= 0) goto start_loop; if (do_quit) break; } - _ecore_loop_time = ecore_time_get(); } } /* timers */ @@ -800,9 +805,9 @@ _ecore_main_loop_iterate_internal(int once_only) if (next_time <= 0) break; if (do_quit) break; } - _ecore_loop_time = ecore_time_get(); } } + _ecore_loop_time = ecore_time_get(); } if (_ecore_fps_debug) { @@ -815,22 +820,25 @@ _ecore_main_loop_iterate_internal(int once_only) /* this should read or write any data to the monitored fd and then */ /* post events onto the ecore event pipe if necessary */ process_events: - if (have_event) _ecore_main_fd_handlers_call(); - do - { +// if (have_event) + _ecore_main_fd_handlers_call(); + _ecore_main_fd_handlers_buf_call(); +// do +// { /* process signals into events .... */ while (_ecore_signal_count_get()) _ecore_signal_call(); /* handle events ... */ _ecore_event_call(); _ecore_main_fd_handlers_cleanup(); - } - while (_ecore_main_fd_handlers_buf_call()); +// } +// while (_ecore_main_fd_handlers_buf_call()); /* ok - too much optimising. let's call idle enterers more often. if we * have events that place more events or jobs etc. on the event queue * we may never get to call an idle enterer if (once_only) */ + if (once_only) _ecore_idle_enterer_call(); in_main_loop--; } diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c index e4d2b12..cb6bc54 100644 --- a/src/lib/ecore/ecore_timer.c +++ b/src/lib/ecore/ecore_timer.c @@ -474,18 +474,12 @@ _ecore_timer_call(double when) // printf("_ecore_timer_call %3.3f <= %3.3f %i %i %p\n", // timer->at, when, timer->just_added, timer->delete_me, timer); if ((timer->at <= when) && -// hmm this ends up pausing some edje program iterators... disable for now -// and see what the fallout is - if any? -// ... -// ok - this does cause problems if disabled. i will need to dig into the -// bottom of this. no quick fixes here :( (timer->just_added == 0) && (timer->delete_me == 0)) { timer->running = EINA_TRUE; timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); - _ecore_timer_call(when); if ((!timer->delete_me) && (timer->func(timer->data))) { /* if the timer would have gone off more than 15 seconds ago, @@ -514,6 +508,7 @@ _ecore_timer_call(double when) } else free(timer); + _ecore_timer_call(when); return 1; } } -- 2.7.4