Re: [gtk-list] Re: Entry fields problem fixed. *blush*



"G. Sumner Hayes" <sumner@collegium.adsl.net.cmu.edu> writes:

> > He did.  Ben's the Debian package maintainer, and all the Debian
> > libraries have to be compiled with -D_REENTRANT so it'll be safe to
> > use them in threaded programs.
> 
> Are gtk/glib/gdk thread safe?  I was under the impression that they were
> not.  I'd love to be told I'm wrong, though.

No, not in the sense that you can make arbitrary calls from arbitrary
threads to gtk functions and expect them not to crash.  But, if you
compile with -D_REENTRANT and libc6 (this is for Linux), you should be
able to use gtk from a threaded program without trouble as long as you
make sure that only one thread is ever inside gtk at a time.  This can
be accomplished (fairly well) with a big pthread_mutex around all
calls to gtk routines.  It may also be sufficient to just make all
your gtk calls from one thread.

-- 
Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94  53 2B 97 F5 D6 4E 39 30



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