Re: Multithreading



On 06/28/01 Mikko Lipasti wrote:
I'm adding a Gtk interface to a multithreaded Perl app. How do I do this 
properly? Pointers to online resources welcome.

Basically, you need to compile the Gtk extension with a threaded perl
and follow a simple rule:
once you start threading, calls to gtk functions should be
included in a Gtk::Gdk->threads_enter/Gtk::Gdk->threads_leave pair
(including entering the main loop).

The Gtk+ FAQ covers this a bit: see point 5.2 at http://www.gtk.org/faq/.
Note that the Gtk binding calls gdk_threads_enter/leave for you
in the timeout/idle/io callbacks, so you don't need to do that
in your programs as the FAQ answer explains.

The Gtk-Perl tarball includes a sample program in Gtk/samples/thread.pl.

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better




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