Re: [patch] Multiple/Java thread support
- From: Owen Taylor <otaylor redhat com>
- To: Paul Fisher <rao gnu org>
- Cc: gtk-list redhat com
- Subject: Re: [patch] Multiple/Java thread support
- Date: 10 Sep 1998 14:04:07 -0400
Paul Fisher <rao@gnu.org> writes:
> I've uploaded gtk-rao-980910-0.patch.gz to incoming. The patch is
> against the CVS tree as of approximately 11:00AM EDT. If anyone would
> like a patch for gtk+-1.1.1, please send me an email.
>
> README:
>
> Multiple Thread Library Support + Java Thread Support
>
> GTK's current threading primitives are hardcoded for pthreads. The
> GNU Classpath Project (http://www.classpath.org) is writing a Java AWT
> implementation using GTK+. As such, we needed to make gdkthreads work
> with the threading facilities provided by the Java Virtual Machine.
> As opposed to adding the ability to compile GTK for either pthreads or
> JNI (java) threads, I went ahead and extended GTK's threading
> primitives to easily switch between different thread implementations
> based on the application using libgtk. It should now be trivial to
> add new thread library support -- such as cthreads or Sun threads.
This looks neat. However, I'm pretty sure that it is the wrong
approach. Do we need to configure GTK+ with
./configure --with-java-threads --with-python-threads --with-guile-threads
--with-pthreads
I think there is a serious scalability problem with that.
Rather, the right thing is to rather do something like:
typedef struct _GdkThreadFuncs {
void (*enter) (void);
void (*leave) (void);
void (*wake) (void);
void (*select)([whatever]);
}
GdkThreadFuncs *gdk_threads_set_funcs (GdkThreadFuncs *funcs);
I'm not completely sure this is the right level of abstraction,
perhaps it should be lower:
gpointer (*create_mutex) (void);
void (*lock_mutex) (gpointer mutex);
void (*unlock_mutex) (gpointer mutex);
But you get the idea -- new thread implementations should be
set at run time, not compile time. The argument given
to --with-threads=pthreads, or whatever, just says which
a default thread mechanism should be compiled in.
Does this sound reasonable?
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]