threads & gnome



Hi,
	I'm currently writing a Gtk+ based multi-threaded app.  Using Gtk
in multi-threaded mode (g_thread_init() & using gdk_threads_enter()
gdk_threads_leave()) is working well so far except for some parts of
gnome.  Now, I realize that this doesn't have much applicability to gtk
exactly, but I was hoping that people could help me to figure out where to
look for the problem.
	The problem: when I call g_thread_init() at the beginning of my
app, my program crashes whenever a gnome menu is accessed (i.e. when it is
clicked on but before it pops up).  The toolbar, canvas, and other gnome
and gtk widgets work fine.  When I don't call g_thread_init(), the menu
works just fine.  In neither case have any new threads been started, the
only difference is calling g_thread_init().  What could g_thread_init() be
doing that would screw up the gnome ui library that much?
	On a related note, is there anything that the gnome libraries
would have to do in order to be thread safe when Gtk is thread safe, or
should just wrapping all gnome calls in gdk_threads_enter() and
gdk_threads_leave() be sufficient?
	Oh, the other thing, is gtk_main really supposed to be called as:
gdk_threads_enter();
gtk_main();
gdk_threads_leave();

Or should the threads calls be omitted?  Should gdk_threads_enter() be
called around all gtk code used in the main thread?  The FAQ was a bit
cryptic on this point, since its example multi-threaded code was
single-threaded.
	Thank you very much.
	-Chris
P.S. please cc me on all replies, as I am unfortunately not on this list
(I'm on gtk-app-devel, but this question seems more appropriate for this
forum.  I apologize for the inconvenience).

-- 
lansdoct@cs.alfred.edu
"If I had had more time I would have not written you at all." - Pascal
Linux Programs: http://cs.alfred.edu/~lansdoct/linux/
Linux - Get there. Today.
Evil Overlord Quote of the Day:
150.I will provide funding and research to develop tactical and strategic
weapons covering a full range of needs so my choices are not limited to
"hand to hand combat with swords" and "blow up the planet".



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]