Le vendredi 02 juin 2006 à 00:28 -0700, heavenscape a écrit : > Hi Michael, > > I am a beginner in Linux programming, and your suggestion works! But I am > still having some problem that the CPU usage is always 100% after the > program starts. Could you please look at my code below and give me some > suggestion? > > Thanks a lot!!! > > Following is some of my code: > > // idle handler of the main loop > gboolean OnIdle(int msgQid) > { > if(thread_signal) > { > RefreshImage(); > } > return TRUE; > } Do you need to reexecute indefinitely this idle handler? If not use: return FALSE; > int main (int argc, char *argv[]) > { > gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, > argc, argv, > GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR, > NULL); > > //register an idle handler to update the image when the background thread > emits a signal > gdk_threads_enter(); > g_idle_add(OnIdle, nMsgQID); /* may need some macros here; I'm a > * PyGTK/GTKmm guy, so the C stuff > * isn't my forte */ > gdk_threads_leave(); > > MainWnd = create_MainWnd (); > gtk_widget_show (MainWnd); > > gtk_main (); > return 0; > } > > -- > View this message in context: http://www.nabble.com/Thread-generated-signals-t1278505.html#a4675519 > Sent from the Gtk+ - General forum at Nabble.com. > > _______________________________________________ > > gtk-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-list > _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list