efl/legacy/ecore/src/lib
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
..
ecore Reschedule timer_current in case of inner mainloop 2010-05-28 02:31:02 +00:00
ecore_cocoa more quartz -> cocoa renaming 2010-03-27 18:28:50 +00:00
ecore_con CEEEEEEEEEEEEEEEEEEEEEEEEDRIC! *spank* 2010-05-16 03:04:18 +00:00
ecore_config even tho its going to be killed... fix it anyway. 2010-02-22 08:08:04 +00:00
ecore_directfb Ecore_Data gone 2010-01-15 21:47:27 +00:00
ecore_evas big patch from Samsung SAIT (Advanced research group) for async multi-frame 2010-05-21 07:10:45 +00:00
ecore_fb This closes bug #507 2010-01-29 11:42:26 +00:00
ecore_file ecore_file_download(): Call the completion_cb (with error status) when a download is aborted 2010-05-18 23:06:07 +00:00
ecore_imf init values with null. 2010-03-08 01:14:12 +00:00
ecore_imf_evas fix warnings 2010-01-22 07:03:04 +00:00
ecore_input various fixes for vc++. I'll add the Visual Studio projects later 2010-04-05 08:26:48 +00:00
ecore_input_evas various fixes for vc++. I'll add the Visual Studio projects later 2010-04-05 08:26:48 +00:00
ecore_ipc Remove dependency on Ecore_Data 2010-01-15 21:47:15 +00:00
ecore_sdl Added missing compose values for SDL key events 2010-01-22 22:26:42 +00:00
ecore_win32 various fixes for vc++. I'll add the Visual Studio projects later 2010-04-05 08:26:48 +00:00
ecore_wince Revert EINA_(TRUE|FALSE) as requested by vincent. 2010-02-27 16:45:20 +00:00
ecore_x big patch from Samsung SAIT (Advanced research group) for async multi-frame 2010-05-21 07:10:45 +00:00
.cvsignore Fixed a couple of debs in e17/libs, added and updated a couple of .cvsignores. 2003-11-13 12:30:50 +00:00
Makefile.am more quartz -> cocoa renaming 2010-03-27 18:28:50 +00:00