Re: Multi-threaded UI Freezes on GDK Call
- From: Michael McCann <naetrick comcast net>
- To: "Brian J. Tarricone" <bjt23 cornell edu>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Multi-threaded UI Freezes on GDK Call
- Date: Tue, 18 Dec 2007 20:37:17 -0500
Brian J. Tarricone wrote:
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?
It's the size of the entire screen: 1024x768
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();
...
Yes, I've already tried that, to no avail. My code basically only
consists of:
gdk_screen_get_default(): Get the default screen
gdk_screen_get_root_window(): Get the root window
gdk_pixbuf_get_from_drawable(): Get a pixbuf from the entire screen
gdk_pixbuf_save_to_bufferv(): Save the pixbuf to a buffer.
Remove all of the GDK calls, and there is no UI freeze. I can even throw in an infinite loop to any function
in the non-UI thread, and the UI does not freeze, which is to be expected.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]