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:02:41 -0500
Brian J. Tarricone wrote:
Michael McCann wrote:
Michael R. Head wrote:
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.
Ahh, ok. How else can I accomplish my goal, then? I need to give GTK the
lock, as I'm calling GDK from another function not in the main GTK loop.
I tried leaving out gdk_threads_enter()/leave() in the CPU-intensive
function, but X gives me errors.
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.
Of course, if I clocked my CPU back up to 3.2GHz, this wouldn't be a problem. ;D However, I can't count on my
users having a fast CPU.
I'll try out that g_idle_add() method tomorrow...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]