Michael McCann wrote:
> Brian J. Tarricone wrote:
>> Don't use gdk in the CPU-intensive function:
> Unfortunately, the GDK calls _are_ what is CPU-intensive. I believe the 
> gdk_pixbuf_get_from_drawable() call is the most intensive. None of my 
> "regular" code is CPU-intensive.

How large is the GdkDrawable?  I wouldn't imagine that to eat too much 
CPU.  You can try only acquiring the gdk lock in your thread when 
absolutely necessary to see if that helps, like this:

do_something_without_gdk();
gdk_threads_enter();
gdk_pixbuf_get_from_drawable();
gdk_threads_leave();
do_other_stuff_without_gdk();
gdk_threads_enter();
do_some_stuff_with_the_gdk_drawable();
gdk_threads_leave();
...

Obviously you don't want to go nuts taking and dropping the lock over 
and over, but this might help track down (or even eliminate) what part 
of your code is blocking and causing the UI to freeze (add some 
printf()s in there too, I guess).

        -brian


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to