efl/legacy/ecore/src/lib/ecore
Lucas De Marchi 98d843e91b Reschedule timer_current in case of inner mainloop
Timers' list is and *ordered list*. Therefore, timers can be added
before timer_current in an inner mainloop. Reschedule timer_current in
this case before looping through timers' list.

Thanks to Barbieri for the insight.

The following test didn't work before and it's ok now (I'm adding it to
ecore_suite too).

static int _timer3(void *data)
{
printf("timer 3, do nothing\n");
return 0;
}

static int _timer2(void *data)
{
printf("timer 2, quit inner\n");
ecore_main_loop_quit();
return 0;
}

static int _timer1(void *data)
{
int *times = data;
(*times)++;
printf("BEGIN: inner\n");

ecore_timer_add(0.3, _timer2, NULL);
ecore_timer_add(0.1, _timer3, NULL);

ecore_main_loop_begin();
printf("END: inner\n");
ecore_main_loop_quit();

return 0;
}

int main(void)
{
int times = 0;

ecore_init();
ecore_timer_add(1.0, _timer1, &times);
printf("BEGIN: main\n");
ecore_main_loop_begin();
assert(times == 1);
printf("timer1 called %d times \n", times);
printf("END: main\n");
return 0;
}

By: Lucas De Marchi <lucas.demarchi@profusion.mobi>



SVN revision: 49245
2010-05-28 02:31:02 +00:00
..
.cvsignore Sssh 2004-03-29 21:11:30 +00:00
Ecore.h added functions for changing/getting a poller's poll interval: ecore_poller_poller_interval_(set|get) along with dox for them 2010-05-19 09:16:37 +00:00
Ecore_Getopt.h revert. does not work 2010-04-05 18:20:49 +00:00
Makefile.am various fixes for vc++. I'll add the Visual Studio projects later 2010-04-05 08:26:48 +00:00
ecore.c various fixes for vc++. I'll add the Visual Studio projects later 2010-04-05 08:26:48 +00:00
ecore_anim.c Fix 'return' with a value in function returning void. 2010-05-11 14:01:42 +00:00
ecore_app.c include process.h for vc++ 2010-04-05 08:38:11 +00:00
ecore_events.c ooh someone somewhere made the main event loop not work quite right. 2010-05-26 11:40:22 +00:00
ecore_exe.c move bitfield booleans to Eina_Bool. 2010-02-23 22:49:15 +00:00
ecore_exe_win32.c * redirection of stdout and stderr (with libc or win32 apps) is working 2010-05-15 18:38:01 +00:00
ecore_exe_wince.c add stub Windows CE ecore_exe. Will be filled later 2010-01-18 18:16:50 +00:00
ecore_getopt.c 'tis an array of pointers, not just a string 2010-04-07 22:09:26 +00:00
ecore_glib.c formatting. 2010-04-27 04:30:55 +00:00
ecore_idle_enterer.c Fix idle_enterers when using recursive main loops. 2010-02-23 22:13:42 +00:00
ecore_idle_exiter.c Fix idle_exiters when using recursive main loops. 2010-02-23 22:25:35 +00:00
ecore_idler.c Fix idlers when using recursive main loops. 2010-02-23 21:27:04 +00:00
ecore_job.c * ecore: Move ecore_job inside ecore. 2010-01-25 21:59:21 +00:00
ecore_main.c formatting cleanups. 2010-05-18 08:01:06 +00:00
ecore_pipe.c F_SETFL and O_NONBLOCK are supported by evil 2010-02-28 17:38:24 +00:00
ecore_poll.c added functions for changing/getting a poller's poll interval: ecore_poller_poller_interval_(set|get) along with dox for them 2010-05-19 09:16:37 +00:00
ecore_private.h big patch from Samsung SAIT (Advanced research group) for async multi-frame 2010-05-21 07:10:45 +00:00
ecore_signal.c various fixes for vc++. I'll add the Visual Studio projects later 2010-04-05 08:26:48 +00:00
ecore_thread.c Release lock before returning 2010-04-12 21:51:35 +00:00
ecore_time.c patch from julian - fix typos in docs. 2009-03-13 09:38:46 +00:00
ecore_timer.c Reschedule timer_current in case of inner mainloop 2010-05-28 02:31:02 +00:00