Re: [gtkmm] multi threading



>dear gtk-- users,
>
>I'm looking for someone that can tell me how I can use the gtk-- GUI in
>a multi threading program. For some reason no GUI toolkit available
>supports threads (I wonder why).
>
>example program:
>	the program creates a new thread and starts it
>	the thread creates a new Gtk::Window
>	the thread is drawing stuff in the Gtk::Window as it loops

the preferred method is to limit all use of gtkmm/GTK+/GDK/Xlib
functions to a single thread. when other threads want work done, they
send a request to the GUI thread via a pipe, which is hooked into the
main event loop of the GUI toolkit.

several of us like passing SigC::Slot<>'s around as a way to neatly
package up arbitrary requests for the GUI thread, and there has been
some discussion and pointers to code that does this on the list within
the last 30 days. check the archives.

the other method is to enclose all use of gtkmm/GTK+/GDK/Xlib
functions in gdk_threads_enter() and gdk_threads_leave(). there are,
however, several reasons why this is a problem for many multithreaded
programs.

--p



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