Re: Work woth GUI from a thread that was made by pthread_create function



Hi Pawel,

On Thu, 2002-02-07 at 20:36, Pawel Salek wrote:
You need to lock gdk mutex before entering the main loop.

     gdk_threads_enter();
     gtk_main();
     gdk_threads_leave();

        You also need to drop locks before doing things eg.

        gdk_threads_leave ();
        do_some_gtk_call ();
        gdk_threads_enter ();

        eg. in signal handlers, and such like - but it very much depends if the
signal is emitted from the Gtk mainloop, or explicitly from another
source, if from another source then depending on whether you're in a
mainloop you need to lock,unlock or unlock,lock in a not altogether
clear fashion.

        In short I'd avoid threads & Gtk+ like the plague.

        Hmm,

                Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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