Re: Multi-threaded UI Freezes on GDK Call
- From: "Michael R. Head" <burner suppressingfire org>
- To: gtk-app-devel-list gnome org
- Subject: Re: Multi-threaded UI Freezes on GDK Call
- Date: Tue, 18 Dec 2007 19:10:28 -0500
I'll break protocol and reply to my own message _again_...
On Tue, 2007-12-18 at 19:05 -0500, Michael R. Head wrote:
On Tue, 2007-12-18 at 18:46 -0500, Michael McCann wrote:
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.
Well, I guess what you need to do is to separate out the CPU intensive
bits of the function from the widget manipulation bits...
my_function() {
compute_real_hard();
gdk_threads_enter();
update_ui();
gdk_threads_leave();
}
Or something like that.
Also, you can skip using gdk_threads_enter() and gdk_threads_leave() if
you instead use g_idle_add(update_ui) and make update_ui a suitable
callback:
http://library.gnome.org/devel/glib/stable/glib-The-Main-Event-Loop.html#g-idle-add
mike
mike
--
Michael R. Head <burner suppressingfire org>
suppressingfire.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]