Re: Multi-threaded UI Freezes on GDK Call
- From: "Brian J. Tarricone" <bjt23 cornell edu>
- To: gtk-app-devel-list gnome org
- Subject: Re: Multi-threaded UI Freezes on GDK Call
- Date: Tue, 18 Dec 2007 17:22:55 -0800
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]