Re: [E-devel] Problem with ecore_main_fd_handler_add() and async GUI updates
Am Thu, 8 Feb 2007 01:14:05 +0100 schrieb Andreas Volz: Hello, it seems perhaps I found the problem. :-) The problem was a bug in my application. Since fixing it I got no more problems with the pipe. See: > Here is the code: > > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > > > Ecore_Evas *ee; > Evas *evas; > > Evas_Object *o_bg; > Evas_Object *o_edje; > Evas_Object *poly; > > pthread_t gps_thread; > pthread_mutex_t gps_mutex = PTHREAD_MUTEX_INITIALIZER; > > void resize_cb(Ecore_Evas *ee); > void print_help (char *app_name); > void gps_callback (struct gps_data_t *gps_data, char *buf, size_t > len, int level); > > int _fd_dp_active(void *data, Ecore_Fd_Handler *fdh); > void dispatcher_init (); > void dispatcher_signal (); > > struct _Dispatcher > { > int fd_read; > int fd_write; > void *data; > Ecore_Fd_Handler *fd_handler; > // callback function?? > }; > > typedef struct _Dispatcher Dispatcher; > > Dispatcher dp; > char edje_signal[13+3]; // holds up to 999 images; should be enough; 13 + 3 = 16 > int main(int argc, char **argv) > { > Evas_Object *o; > int edje_w = 240; > int edje_h = 240; > char *theme; > struct stat stat_buf; > bool theme_default; > char theme_default_name[] = "../data/empass.edj"; > struct gps_data_t *gpsData; > > switch (argc) > { > case 1: > theme_default = !stat (theme_default_name, &stat_buf); > if (theme_default) > theme = theme_default_name; > else > print_help (argv[0]); > break; > case 2: > theme = argv[1]; > break; > default: > print_help (argv[0]); > break; > } > > gpsData = gps_open ("localhost", "2947"); > > if (gpsData) > { > gps_query (gpsData, "rw\n"); > gps_query (gpsData, "j=1\n"); > > gps_set_callback (gpsData, &gps_callback, &gps_thread); > } > else > { > fprintf (stderr, "Warning: running without gpsd support!\n"); > } > > if (!ecore_init ()) > { > fprintf (stderr, "Error while initializing Ecore!\n"); > exit (1); > } > > ecore_app_args_set(argc, (const char **)argv); > > if (!ecore_evas_init ()) > { > fprintf (stderr, "Error while initializing Ecore_Evas!\n"); > exit (1); > } > > if (!edje_init()) > { > fprintf (stderr, "Error while initializing Evas!\n"); > exit (1); > } > > dispatcher_init (); > > // TODO: warum geht Xrender auf dem Latop nicht? >/*if > (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_XRENDER_X11)) > ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, edje_w, edje_h); else > {*/ > if > (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_X11)) > ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, edje_w, edje_h); //} > if (!ee) > { > if > (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_FB)) > ee = ecore_evas_fb_new(NULL, 270, edje_w, edje_h); if (!ee) > ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, edje_w, edje_h); > if (!ee) > { > fprintf(stderr, "Cannot create Canvas!\n"); > exit(-1); > } > } > > ecore_evas_shaped_set (ee, 1); > ecore_evas_title_set (ee, "empass"); > > //ecore_evas_borderless_set(ee, 1); > ecore_evas_sticky_set(ee, 1); > > evas = ecore_evas_get(ee); > evas_image_cache_set(evas, 8192 * 1024); > evas_font_cache_set(evas, 512 * 1024); > > o = evas_object_rectangle_add(evas); > evas_object_move(o, 0, 0); > evas_object_resize(o, edje_w, edje_h); > > evas_object_color_set(o, 0, 0, 0, 0); > evas_object_focus_set(o, 1); > > evas_object_show(o); > o_bg = o; > > o = edje_object_add(evas); > > edje_object_file_set(o, theme, "main"); > evas_object_move(o, 0, 0); > evas_object_resize(o, edje_w, edje_h); > > evas_object_show(o); > o_edje = o; > > ecore_evas_callback_resize_set(ee, resize_cb); > ecore_evas_show(ee); > > ecore_main_loop_begin(); > > edje_shutdown(); > ecore_evas_shutdown(); > ecore_shutdown(); > > return 0; > } > > void dispatcher_init () > { > int fd[2]; > >/* Create the file descriptors */ > if (pipe(fd) == 0) > { > dp.fd_read = fd[0]; > dp.fd_write = fd[1]; > fcntl(dp.fd_read, F_SETFL, O_NONBLOCK); > dp.fd_handler = ecore_main_fd_handler_add (dp.fd_read, >ECORE_FD_READ, >_fd_dp_active, >&dp, >NULL, NULL); > ecore_main_fd_handler_active_set(dp.fd_handler, ECORE_FD_READ); > } > else > { > fprintf (stderr, "pipe() failed\n"); > exit (1); > } > } > > int _fd_dp_active (void *data, Ecore_Fd_Handler *fdh) > { > int fd; > int len; > char buf[1]; > char edje_signal_local[13+3]; > unsigned char *frame_data; > Dispatcher *dp
Re: [E-devel] Problem with ecore_main_fd_handler_add() and async GUI updates
Am Tue, 13 Feb 2007 15:33:21 +0100 schrieb Andreas Volz: > Am Sat, 10 Feb 2007 06:11:52 +0900 schrieb Carsten Haitzler (The > Rasterman): > > > On Thu, 8 Feb 2007 01:14:05 +0100 Andreas Volz <[EMAIL PROTECTED]> > > babbled: > > > > > Hello, > > > > > > I've some problems with ecore_main_fd_handler_add(). In my > > > application a pipe is used to synchronize the asynchronous data > > > generation thread and the GUI. It works great in 8 of 10 app > > > running cases. In 2 of 10 cases I start the application but the > > > callback function from ecore_main_fd_handler_add() is never > > > called, no matter how much bytes I throw into the pipe. > > > > > > Before I start to debug the ecore functions I hope someone could > > > look over my code and help me to find the bug (if existing). > > > > i wish i had time to check - but for now, i don't. i'm busily trying > > to catch up on my mail. one guess might be that the child starts > > sending data before the parent has added the fd handler in? but > > Hm, I could try what happens if I wait some time before putting data > into the pipe. I waited some seconds after creating the pipe before writing the first byte into the pipe. This doesn't solve the problem. regards Andreas - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Problem with ecore_main_fd_handler_add() and async GUI updates
Am Sat, 10 Feb 2007 06:11:52 +0900 schrieb Carsten Haitzler (The Rasterman): > On Thu, 8 Feb 2007 01:14:05 +0100 Andreas Volz <[EMAIL PROTECTED]> > babbled: > > > Hello, > > > > I've some problems with ecore_main_fd_handler_add(). In my > > application a pipe is used to synchronize the asynchronous data > > generation thread and the GUI. It works great in 8 of 10 app > > running cases. In 2 of 10 cases I start the application but the > > callback function from ecore_main_fd_handler_add() is never called, > > no matter how much bytes I throw into the pipe. > > > > Before I start to debug the ecore functions I hope someone could > > look over my code and help me to find the bug (if existing). > > i wish i had time to check - but for now, i don't. i'm busily trying > to catch up on my mail. one guess might be that the child starts > sending data before the parent has added the fd handler in? but Hm, I could try what happens if I wait some time before putting data into the pipe. > otherwise this should work. another guess is the child is calling > ecore routines and somehow destroying ecore's internal data structs. I hope you've some time to check this problem later. Perhaps I'll look into ecore myself, but I assume that I need a much more time to indentify the problem. regards Andreas - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Problem with ecore_main_fd_handler_add() and async GUI updates
On Thu, 8 Feb 2007 01:14:05 +0100 Andreas Volz <[EMAIL PROTECTED]> babbled: > Hello, > > I've some problems with ecore_main_fd_handler_add(). In my application > a pipe is used to synchronize the asynchronous data generation thread > and the GUI. It works great in 8 of 10 app running cases. In 2 of 10 > cases I start the application but the callback function from > ecore_main_fd_handler_add() is never called, no matter how much bytes I > throw into the pipe. > > Before I start to debug the ecore functions I hope someone could look > over my code and help me to find the bug (if existing). i wish i had time to check - but for now, i don't. i'm busily trying to catch up on my mail. one guess might be that the child starts sending data before the parent has added the fd handler in? but otherwise this should work. another guess is the child is calling ecore routines and somehow destroying ecore's internal data structs. > Here is the code: > > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > > > Ecore_Evas *ee; > Evas *evas; > > Evas_Object *o_bg; > Evas_Object *o_edje; > Evas_Object *poly; > > pthread_t gps_thread; > pthread_mutex_t gps_mutex = PTHREAD_MUTEX_INITIALIZER; > > void resize_cb(Ecore_Evas *ee); > void print_help (char *app_name); > void gps_callback (struct gps_data_t *gps_data, char *buf, size_t len, > int level); > > int _fd_dp_active(void *data, Ecore_Fd_Handler *fdh); > void dispatcher_init (); > void dispatcher_signal (); > > struct _Dispatcher > { > int fd_read; > int fd_write; > void *data; > Ecore_Fd_Handler *fd_handler; > // callback function?? > }; > > typedef struct _Dispatcher Dispatcher; > > Dispatcher dp; > char edje_signal[13+3]; // holds up to 999 images; should be enough; > > int main(int argc, char **argv) > { > Evas_Object *o; > int edje_w = 240; > int edje_h = 240; > char *theme; > struct stat stat_buf; > bool theme_default; > char theme_default_name[] = "../data/empass.edj"; > struct gps_data_t *gpsData; > > switch (argc) > { > case 1: > theme_default = !stat (theme_default_name, &stat_buf); > if (theme_default) > theme = theme_default_name; > else > print_help (argv[0]); > break; > case 2: > theme = argv[1]; > break; > default: > print_help (argv[0]); > break; > } > > gpsData = gps_open ("localhost", "2947"); > > if (gpsData) > { > gps_query (gpsData, "rw\n"); > gps_query (gpsData, "j=1\n"); > > gps_set_callback (gpsData, &gps_callback, &gps_thread); > } > else > { > fprintf (stderr, "Warning: running without gpsd support!\n"); > } > > if (!ecore_init ()) > { > fprintf (stderr, "Error while initializing Ecore!\n"); > exit (1); > } > > ecore_app_args_set(argc, (const char **)argv); > > if (!ecore_evas_init ()) > { > fprintf (stderr, "Error while initializing Ecore_Evas!\n"); > exit (1); > } > > if (!edje_init()) > { > fprintf (stderr, "Error while initializing Evas!\n"); > exit (1); > } > > dispatcher_init (); > > // TODO: warum geht Xrender auf dem Latop nicht? >/*if > (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_XRENDER_X11)) > ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, edje_w, edje_h); else > {*/ > if > (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_X11)) > ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, edje_w, edje_h); //} > if (!ee) > { > if > (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_FB)) > ee = ecore_evas_fb_new(NULL, 270, edje_w, edje_h); if (!ee) > ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, edje_w, edje_h); > if (!ee) > { > fprintf(stderr, "Cannot create Canvas!\n"); > exit(-1); > } > } > > ecore_evas_shaped_set (ee, 1); > ecore_evas_title_set (ee, "empass"); > > //ecore_evas_borderless_set(ee, 1); > ecore_evas_sticky_set(ee, 1); > > evas = ecore_evas_get(ee); > evas_image_cache_set(evas, 8192 * 1024); > evas_font_cache_set(evas, 512 * 1024); > > o = evas_object_rectangle_add(evas); > evas_object_move(o, 0, 0); > evas_object_resize(o, edje_w, edje_h); > > evas_object_color_set(o, 0, 0, 0, 0); > evas_object_focus_set(o, 1); > > evas_object_show(o); > o_bg = o; > > o = edje_object_add(evas); > > edje_object_file_set(o, theme, "main"); > evas_object_move(o, 0, 0); > evas_object_resize(o, edje_w, edje_h); > > evas_object_show(o); > o_edje = o; > > ecore_evas_callback_resize_set(ee, resize_cb); > ecore_evas_show(ee); > > ecore_main_loop_begin(); > > edje_shutdown(); > ecore_evas_shutdown(); > ecore_shutdown(); > > return 0; > } > > void dispatcher_init () > { > int fd[2]; > >/* Create the file descriptors */ > if (pipe(fd) == 0) > { > dp.fd_read = fd[0]; > dp.fd_wr
[E-devel] Problem with ecore_main_fd_handler_add() and async GUI updates
Hello, I've some problems with ecore_main_fd_handler_add(). In my application a pipe is used to synchronize the asynchronous data generation thread and the GUI. It works great in 8 of 10 app running cases. In 2 of 10 cases I start the application but the callback function from ecore_main_fd_handler_add() is never called, no matter how much bytes I throw into the pipe. Before I start to debug the ecore functions I hope someone could look over my code and help me to find the bug (if existing). Here is the code: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include Ecore_Evas *ee; Evas *evas; Evas_Object *o_bg; Evas_Object *o_edje; Evas_Object *poly; pthread_t gps_thread; pthread_mutex_t gps_mutex = PTHREAD_MUTEX_INITIALIZER; void resize_cb(Ecore_Evas *ee); void print_help (char *app_name); void gps_callback (struct gps_data_t *gps_data, char *buf, size_t len, int level); int _fd_dp_active(void *data, Ecore_Fd_Handler *fdh); void dispatcher_init (); void dispatcher_signal (); struct _Dispatcher { int fd_read; int fd_write; void *data; Ecore_Fd_Handler *fd_handler; // callback function?? }; typedef struct _Dispatcher Dispatcher; Dispatcher dp; char edje_signal[13+3]; // holds up to 999 images; should be enough; int main(int argc, char **argv) { Evas_Object *o; int edje_w = 240; int edje_h = 240; char *theme; struct stat stat_buf; bool theme_default; char theme_default_name[] = "../data/empass.edj"; struct gps_data_t *gpsData; switch (argc) { case 1: theme_default = !stat (theme_default_name, &stat_buf); if (theme_default) theme = theme_default_name; else print_help (argv[0]); break; case 2: theme = argv[1]; break; default: print_help (argv[0]); break; } gpsData = gps_open ("localhost", "2947"); if (gpsData) { gps_query (gpsData, "rw\n"); gps_query (gpsData, "j=1\n"); gps_set_callback (gpsData, &gps_callback, &gps_thread); } else { fprintf (stderr, "Warning: running without gpsd support!\n"); } if (!ecore_init ()) { fprintf (stderr, "Error while initializing Ecore!\n"); exit (1); } ecore_app_args_set(argc, (const char **)argv); if (!ecore_evas_init ()) { fprintf (stderr, "Error while initializing Ecore_Evas!\n"); exit (1); } if (!edje_init()) { fprintf (stderr, "Error while initializing Evas!\n"); exit (1); } dispatcher_init (); // TODO: warum geht Xrender auf dem Latop nicht? /*if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_XRENDER_X11)) ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, edje_w, edje_h); else {*/ if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_X11)) ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, edje_w, edje_h); //} if (!ee) { if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_FB)) ee = ecore_evas_fb_new(NULL, 270, edje_w, edje_h); if (!ee) ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, edje_w, edje_h); if (!ee) { fprintf(stderr, "Cannot create Canvas!\n"); exit(-1); } } ecore_evas_shaped_set (ee, 1); ecore_evas_title_set (ee, "empass"); //ecore_evas_borderless_set(ee, 1); ecore_evas_sticky_set(ee, 1); evas = ecore_evas_get(ee); evas_image_cache_set(evas, 8192 * 1024); evas_font_cache_set(evas, 512 * 1024); o = evas_object_rectangle_add(evas); evas_object_move(o, 0, 0); evas_object_resize(o, edje_w, edje_h); evas_object_color_set(o, 0, 0, 0, 0); evas_object_focus_set(o, 1); evas_object_show(o); o_bg = o; o = edje_object_add(evas); edje_object_file_set(o, theme, "main"); evas_object_move(o, 0, 0); evas_object_resize(o, edje_w, edje_h); evas_object_show(o); o_edje = o; ecore_evas_callback_resize_set(ee, resize_cb); ecore_evas_show(ee); ecore_main_loop_begin(); edje_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); return 0; } void dispatcher_init () { int fd[2]; /* Create the file descriptors */ if (pipe(fd) == 0) { dp.fd_read = fd[0]; dp.fd_write = fd[1]; fcntl(dp.fd_read, F_SETFL, O_NONBLOCK); dp.fd_handler = ecore_main_fd_handler_add (dp.fd_read, ECORE_FD_READ, _fd_dp_active, &dp, NULL, NULL); ecore_main_fd_handler_active_set(dp.fd_handler, ECORE_FD_READ); } else { fprintf (stderr, "pipe() failed\n"); exit (1); } } int _fd_dp_active (void *data, Ecore_Fd_Handler *fdh) { int fd; int len; char buf[1]; char edje_signal_local[13+3]; unsigned char *frame_data; Dispatcher *dp; printf ("asynchronous data arrived\n"); dp = data; fd = ecore_main_fd_handler_fd_get(fdh); // reads all events and use only one