Re: multithreaded apps




Ionutz Borcoman <borco@borco-ei.eng.hokudai.ac.jp> writes:

> Hi,
> 
> I have made a small multi-threaded application using Owen's hints. I
> have put it at:
> http://borco-ei.eng.hokudai.ac.jp/~borco/vdk/download/misc/test1.tar.gz
> 
> The aplication is very simple, in pure GTK (made quickly with glade).
> Just type:
> ./configure
> make
> ./project1
> 
> I would appreciate any comments, especially about what (and when) should
> I lock with mutexes.

As far as the locking for GTK+ goes, it looks right, though
you need a gdk_threads_enter() gdk_threads_leave() pair around
the call to gtk_main() in the main thread. Something like:

  gdk_threads_enter();

  window = create_window ();
  gtk_widget_show (window);

  gtk_main();

  gdk_threads_leave();

Regards,
                                        Owen



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