Re: multithreading problem.



On Tue, 4 Jun 2002, Paul Davis wrote:

> >	I called gthread_init() at the beginning of the program
> >and the gtk_main() is surrounded by threads_enter(), threads_leave() calls.
> >	It probably doesn't make any difference but I am using pthreads.
>
> no, it makes no difference. there's no big secret to doing this. you
> either wrap *every* call, or you use the generally simpler and more
> designer-style approach of having only a single thread ever make
> glib/gdk/gtk/xlib calls (others communicate with that thread via a
> pipe or some other mechanism). it works - i've written several MT
> programs that use GTK+ (in some cases, with up to 10 threads), and i
> have no problems with any of this stuff until i forget the rule and
> end up inadvertently calling a glib/gdk/gtk/xlib function from the
> wrong thread.


I guess I am going to give the second approach a try. A simple pipe should
do the job but is there any message system in gtk/glib/gdk that
should be used (user defined signals ?) ?

Thanks a lot.
Bob.

>
> --p
>




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