Re: GTK and threaded applications
- From: Michael L Torrie <torriem chem byu edu>
- To: kornelix <kornelix yahoo de>
- Cc: gtk app dev mail list <gtk-app-devel-list gnome org>
- Subject: Re: GTK and threaded applications
- Date: Tue, 31 Jan 2006 14:05:51 -0700
On Tue, 2006-01-31 at 18:28 +0100, kornelix wrote:
Following the guidelines in the FAQ, I constructed my application
threads as follows:
gdk_threads_enter(); // enter thread
(do some work, including GTK calls)
gdk_flush(); // exit thread
gdk_threads_leave();
return 0;
Now my multi-threaded application executes its threads one after the
other, instead of in parallel. Apparently the above method introduces a
lock or mutex which allows only one thread at a time to execute.
Is this a hopeless situation, or is there some other way?
(other than putting all GTK calls in the main program)
Just put the gdk_* threads and flush calls around the actual GTK calls.
that way only gui updates themselves are put in mutexes (locked). The
way you are currently doing it, your actual business logic ends up in
the mutex, and so if it is lengthy, it will block all the other threads.
Michael
thanks,
Mike
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]