Re: thread safe gtk?
- From: Rob Browning <rlb cs utexas edu>
- To: Owen Taylor <otaylor gtk org>
- Cc: M Stekelenburg student utwente nl, gtk-list redhat com
- Subject: Re: thread safe gtk?
- Date: 11 May 1998 16:02:03 -0500
Owen Taylor <otaylor@gtk.org> writes:
> I just fooled around with a bit and created something like this:
>
> ftp://ftp.gtk.org/pub/users/otaylor/gtkthreads-0.1.tar.gz
>
> (Calling it just gtkthreads is pretty presumptious, considering
> how little I know about threading). It seems to work reasonably
> reliably in limited testing.
I've got this, and I have some comments which I'll post in a moment...
> The best long term approach is most likely to modify GTK to
> optionally do:
>
> #ifdef GTK_USE_PTHREADS
> gtk_mutex_unlock (>k_mutex);
> #endif
> select (...)
> #ifdef GTK_USE_PTHREADS
> gtk_mutex_lock (>k_mutex);
> #endif
>
> Which allows other threads to get the GTK lock without having
> to communicate with the main thread.
It would be nice if this could be run-time rather than compile-time
configurable. Something like:
if(gtk_using_threads()) gtk_mutex_unlock (>k_mutex);
select (...)
if(gtk_using_threads()) gtk_mutex_lock (>k_mutex);
(gtk_using_threads() could just be a macro referring to a global for
now. Using the macro means we have more flexibility later. The
overhead for run-time testing (basically this "if" test) should be
undetectable.)
--
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]