forked from enlightenment/efl
98d843e91b
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, ×); 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 |
||
---|---|---|
.. | ||
.cvsignore | ||
Ecore.h | ||
Ecore_Getopt.h | ||
Makefile.am | ||
ecore.c | ||
ecore_anim.c | ||
ecore_app.c | ||
ecore_events.c | ||
ecore_exe.c | ||
ecore_exe_win32.c | ||
ecore_exe_wince.c | ||
ecore_getopt.c | ||
ecore_glib.c | ||
ecore_idle_enterer.c | ||
ecore_idle_exiter.c | ||
ecore_idler.c | ||
ecore_job.c | ||
ecore_main.c | ||
ecore_pipe.c | ||
ecore_poll.c | ||
ecore_private.h | ||
ecore_signal.c | ||
ecore_thread.c | ||
ecore_time.c | ||
ecore_timer.c |