Re: Gtk2+ and thread safety



Hi Owen,

Thanks for the feedback but we are calling gdk_threads_init just after g_threads_init so I don't think this is the problem.

Owen Taylor wrote:

Nicholas Allen - Sun Ireland - Software Engineer <nicholas allen ireland sun com> writes:

We are working on a Java peer set for gtk at Sun. We have it pretty
much finished apart from a few bugs which are mostly due to missing
features in Gtk 1.2. It was our original intention to use Gtk+ 1.2 but
we are investigating the possibility of migrating it to 2.0 to fix the
bugs due to missing features in 1.2. I have ported the code to the new
2.0 library but we are now experiencing many thread synchronization
problems. I have read the threading documentation but it does not
appear there is anything extra that we have to do (apart from calling
gdk_threads_init as well as g_threads_init). The code worked fine
under 1.2 but is failing nearly all the time on 2.0.

I think what's probably going on is, from:

http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html

 GDK is no longer put into threaded mode automatically when
 g_thread_init() has been called. In order to use the global GDK
 thread mutex with gdk_threads_enter() and gdk_threads_leave(), you
 must call gdk_threads_init() explicitly. If you aren't using GDK and
 GTK+ functions from multiple threads, there is no reason to call
 gdk_threads_init().

Regards,
                                       Owen
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


--
Nick Allen
Software Engineer
Sun Microsystems Ireland Ltd
Hamilton House
East Point Business Park
Dublin 3

email: nicholas allen ireland sun com

The views expressed in this email are not necessarily the views of Sun Microsystems or its staff






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