On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote: > On Tue, 2007-12-18 at 16:45 -0500, Michael McCann wrote: > > I've got a multithreaded GTK application. One thread runs gtk_main(): > > > > gtk_threads_enter(); > > gtk_main(); > > gtk_threads_leave(); > > I assume you meant > > > g_threads_init(); > gdk_threads_init(); > gtk_init(); > > gdk_threads_enter(); > gtk_main(); > gdk_threads_leave(); > > right?
> > The other thread is an infinite loop that sleeps for one second on each > > loop. Every x seconds, the infinite loop calls a function, which makes > > some GDK calls. At the beginning of this function, gdk_threads_enter() > > is called; at the end, gdk_flush() and gdk_threads_leave() is called. > > > > Whenever this function is called, the UI freezes and CPU usage jumps to > > 100% for about one second (no other applications freeze, of course). > > I've tried calling gdk_threads_leave()/enter() before and after each GDK > > call to no avail. I run g_thread_init() and gdk_threads_init() at the > > beginning of my program. Does your special function take time to do its job? If so, then that would be why. For example: ... while(1) { gdk_threads_enter(); sleep(1) gdk_threads_leave(); sleep(10) }; ... you'd freeze your app for a second every 10 seconds. > > In the function, gdk_screen_get_default(), gdk_screen_get_root_window(), > > gdk_pixbuf_get_from_drawable(), and gdk_pixbuf_save_to_bufferv() are > > called. > > > > I'm using NetBSD on a P4 1.2GHz. What am I doing wrong? I've asked this > > question on IRC (irc.gnome.org, #gtk+) but noone seems to know the problem. > > _______________________________________________ -- Michael R. Head <[EMAIL PROTECTED]> http://www.suppressingfire.org/~burner/ http://suppressingfire.livejournal.com
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list