Re: [gtk-list] Re: [patch] Multiple/Java thread support



Attached is a new patch against GTK+ 1.1.1.  Owen and Pablo, if you
all like it, I'll make a patch against the CVS tree and upload it to
incoming on ftp.gtk.org.

Here's a brief overview:

Unlike the previous patch, which allowed additional support of thread
libraries at compile time, the current patch allows additional support
of thread libraries at run time.  A default implementation of pthreads
is included and is enabled if --with-posix-threads is given to
configure.  Regardless of how configure is run, the ability to add
thread libraries at run time is always allowed.

Additional thread libraries are supported by implementing a
GdkMutexFuncs and then passing a pointer to it to "void
gdk_threads_set_funcs (GdkMutexFuncs *funcs)".

typedef struct _GdkMutexFuncs {
  gpointer (*create_mutex)  (gpointer init);
  void     (*lock_mutex)    (gpointer mutex);
  void     (*unlock_mutex)  (gpointer mutex);
  void     (*destroy_mutex) (gpointer mutex);
} GdkMutexFuncs;

create_mutex is passed a gpointer which allows for "hinting" on what
kind of mutex should be created.  For example, in the pthreads
implementation, create_mutex can be passed a (pthread_mutexattr_t *).
If the gpointer passed is NULL, create_mutex should create a default
mutex.

However, in the case of certain thread libraries, such as Java, the
init arg has a requirement that it not be NULL.

The functions changed/new functions in gdkthreads now look like:

void           gdk_threads_set_funcs (GdkMutexFuncs *funcs);
GdkMutexFuncs* gdk_threads_get_funcs (void);
gpointer       gdk_threads_init      (gpointer init);
void           gdk_threads_enter     (void);
void           gdk_threads_leave     (void);
void           gdk_threads_deinit    (void);

gdk_threads_init returns a pointer to the created mutex, or NULL if
the mutex could not be created.  The "init" arg is passed directed to
the create_mutex function.

If GTK+ is compiled with posix threading enabled, then a call to
gdk_threads_init sets up a posix mutex, and there's no need to have
previously called gdk_threads_set_funcs.

begin 664 gtk-rao-980912-0.patch.gz
M'XL(".._^C4``V=T:RUR86\M.3@P.3$R+3`N<&%T8V@`I5IY=]I($O_;?(H:
MDLT(@S`"7YAQ7HB-'3;X>`9ODLWDZ0G1@)Z%Q.JP\6;RW;>JNW5AB9`=XEC0
M75U=757]JP-/K.D4U!!4#]1;<.W)WBQXJ*I:'?_M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