Hello,
I've a strange bug with Ecore when I will add a timer after the
ecore_main_loop_begin (); when this main_loop is in a pthread.
I use the last Ecore snapshot 0.9.9.041 and the bug can be reproduced
with the file source attached to this email.
For compile, just : gcc buggy_timer.c -lecore -lpthread -o buggy_timer
Without change in the source, the output is :
wait 5 sec
create timer 2
In this case, a timer2 is created ~5 seconds after the
ecore_main_loop_begin (); and never start. The ecore_main_loop_begin ();
is called from a pthread and it seems to be the problem.
After the "create timer 2", each second the text "TIMER 2" must
appear but it doesn't work.
If you uncomment the lines 52 and 53. Then timer1 is created
before ecore_main_loop_begin (); and in this case, after 5 seconds
in this example, the timer2 is created too.. and the output is :
create timer 1
wait 5 sec
TIMER 1
TIMER 1
TIMER 1
TIMER 1
create timer 2
TIMER 1
TIMER 2
TIMER 1
TIMER 2
TIMER 1
TIMER 2
TIMER 1
TIMER 2
TIMER 1
etc,..
This output is okay.. Just a thing is strange in this case too, CTRL+C
break the loop but the program is not killed.
I don't understand the bugs.
And if I put de main_loop_begin in the pthread, it is just because I
use Ecore in a library.
Regards,
Mathieu SCHROETER
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <Ecore.h>
Ecore_Timer *timer1 = NULL;
Ecore_Timer *timer2 = NULL;
int
timer1_tick (void *data) {
printf ("TIMER 1\n");
return 1;
}
int
timer2_tick (void *data) {
printf ("TIMER 2\n");
return 1;
}
void *
thread_efl (void *arg)
{
(void) arg;
ecore_main_loop_begin ();
pthread_exit (0);
}
int
init_efl (pthread_t *th_efl)
{
ecore_init ();
if (pthread_create (th_efl, NULL, thread_efl, NULL) >= 0)
return 0;
return -1;
}
int
main (void) {
pthread_t th;
ecore_init ();
printf ("create timer 1\n");
timer1 = ecore_timer_add (1.0, timer1_tick, NULL);
init_efl (&th);
printf ("wait 5 sec\n");
sleep (5);
printf ("create timer 2\n");
timer2 = ecore_timer_add (1.0, timer2_tick, NULL);
while (1)
sleep (100000);
ecore_shutdown ();
return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel