Re: Gnome/Gtk and thread safety



On 17 Oct 2000, Maciej Stachowiak wrote:

> "Dan Maas" <dmaas dcine com> writes:
> 
> > > Hi, gtk+ and Gnome libraries are generally not thread safe.  Support for
> > > multithreaded programs (GUI calls can be in different threads) is almost
> > > an absolute requirement for a modern software framework.
> > 
> > Really? I have yet to see a situation where multithreading is truly
> > necessary in a GUI application. It is easy to assume one needs threads when
> > safer alternatives would suffice. What specific uses do you envision for a
> > threaded GUI framework?
> 
> What's a safer alternative to avoiding blocking the UI on slow I/O
> operations or the like? (Hint: main loop async callback based coding
> is not it in most cases...)

  This may help:

  I have written a GtkObject called GtkThread, which allows you to launch
a thread with a method, monitors it (with a 100 ms timeout) and emits a
signal when the thread exits. You have no idea how much this simple object
simplifies thread programming. Obviously, it doesn't solve the problem (if
you consider there is a problem) -- you have to aquire to global gtk lock
if you need to operate on widgets. But most of the time threads are only
used to do non-gui work, while the main thread takes care of the gui,
creating other threads, etc.

  In case anyone finds it useful, you can find it in the source
distribution of NumExp (numexp.sourceforge.net).

>  
>  - Maciej
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 

-- 
Gustavo J. A. M. Carneiro
[http://linuxdeec.fe.up.pt/~ee96090]





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