-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Brian J. Tarricone wrote: > On Sat, 04 Aug 2007 22:50:06 +0100 Chris Vine wrote: > >> On Sat, 2007-08-04 at 22:07 +0800, Gregory Hosler wrote: >>> That threads_enter/threads_leave doesn't look so bad, since I'm not >>> doing alot of gtk withing my thread. Looks like it might be the way >>> to go for me. >> You may be missing the point. If you access GTK+ from more than one >> thread, then all operations with GTK+ need to protected with the GDK >> lock, in any thread, including in the main GUI thread. That is why >> using g_idle_add() is often a better approach. > > Well, not really. All gtk/gdk calls in the non-main thread need to be > protected, and also calls in the main thread that are done from an > idle or timeout function. Calls in the main thread from a gtk signal > handler don't need to be protected as they're called within the gdk > lock already. You also need to wrap gtk_main() in the main thread with > gdk_threads_enter()/_leave(). > > If you use the approach of always making gtk/gdk calls from the main > thread (by calling g_idle_add() from other threads)
I'm looking for code examples specifically on how to use/implement g_idle_add(). Know any projects that uses g_idle_add() and related infrastructure? many thanks and best rgds, - -Greg > then you shouldn't > use gdk_threads_enter()/_leave() at all, and indeed shouldn't even call > gdk_threads_init(). This is still, IMHO, the easier and more reliable > approach (and will work on win32 as well as x11, whereas the above > approach will not). > > -brian > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list - -- +---------------------------------------------------------------------+ Please also check the log file at "/dev/null" for additional information. (from /var/log/Xorg.setup.log) | Greg Hosler [EMAIL PROTECTED] | +---------------------------------------------------------------------+ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGtUQ0404fl/0CV/QRAsR0AJ41Hip4BSpqZ6ZM/twRTpc2pu2VcgCgqZ4B s7iby7yRfpQExU34xAn0psQ= =0w50 -----END PGP SIGNATURE----- _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list