Re: threading with Gtk-Perl

Paolo Molaro <> writes:

> On Mon, Nov 08, 1999 at 12:57:20PM -0500, Steve Cresawn wrote:
> > Is it possible to write multithreaded applications in Gtk-Perl?  If so,
> > could someone please inform me of the syntax?
> I never used Gtk with a threaded perl, but a few days ago I added 
> Gtk::Gdk->threads_{enter,leave} to the gnome-perl cvs module.
> Make sure you wrap any call to the Gtk module with the
> enter/leave combo.
> I don't know if there is a way to make this happen automagically
> with an XS trick or something: I need to ask a perl guru.

When using threaded GTK+ in conjunction with a threaded language,
one may have to do a bit more than simple wrap
threads_enter/threads_leave - you have to be careful not to
get into deadlocks between the locks of the binding and the
GTK+ lock. 

The source code for the Python bindings for GTK+ are probably a
good reference for some of the things you need to do. After
some struggles, threading works quite well in GTK/Python.
The Red Hat 6.1 installer is written in threaded GTK/Python.

Also, I believe that the thread support in Perl5.005 is officially
considered "experimental". There are some members of the Perl
development community who are quite unhappy with the way
it was implemented. 

I haven't played around with Perl threading since some of the
pre-releases - at that point it wasn't very stable, though I
believe it has gotten a lot better. Still, you might want
to excercise a bit of caution before committing too much
to writing something using GTK+ and threaded Perl.


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