+Fri May 15 21:16:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ Basic thread-awareness:
+
+ * acconfig.h configure.in: New option --with-threads=[yes/posix/no]
+
+ * gdk/Makefile.am gdk/gdkthreads.c: Added new functions
+ gdk_threads_[init/enter/leave] for applications, plus
+ gdk_threads_wake to wake the mainloop thread out of
+ the select().
+
+ * gtk/Makefile.am: gtk/testthreads.c: Test program for threads
+
+Fri May 15 12:08:48 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/testgtk.c (list_clear): Account for the fact
+ that gtk_list_clear_items is not inclusive. (Clears
+ [start, end))
+
Fri May 15 12:31:27 1998 rodo <doulik@karlin.mff.cuni.cz>
* gdk/gdk.c: include gdkkeysyms.h always
+Fri May 15 21:16:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ Basic thread-awareness:
+
+ * acconfig.h configure.in: New option --with-threads=[yes/posix/no]
+
+ * gdk/Makefile.am gdk/gdkthreads.c: Added new functions
+ gdk_threads_[init/enter/leave] for applications, plus
+ gdk_threads_wake to wake the mainloop thread out of
+ the select().
+
+ * gtk/Makefile.am: gtk/testthreads.c: Test program for threads
+
+Fri May 15 12:08:48 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/testgtk.c (list_clear): Account for the fact
+ that gtk_list_clear_items is not inclusive. (Clears
+ [start, end))
+
Fri May 15 12:31:27 1998 rodo <doulik@karlin.mff.cuni.cz>
* gdk/gdk.c: include gdkkeysyms.h always
+Fri May 15 21:16:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ Basic thread-awareness:
+
+ * acconfig.h configure.in: New option --with-threads=[yes/posix/no]
+
+ * gdk/Makefile.am gdk/gdkthreads.c: Added new functions
+ gdk_threads_[init/enter/leave] for applications, plus
+ gdk_threads_wake to wake the mainloop thread out of
+ the select().
+
+ * gtk/Makefile.am: gtk/testthreads.c: Test program for threads
+
+Fri May 15 12:08:48 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/testgtk.c (list_clear): Account for the fact
+ that gtk_list_clear_items is not inclusive. (Clears
+ [start, end))
+
Fri May 15 12:31:27 1998 rodo <doulik@karlin.mff.cuni.cz>
* gdk/gdk.c: include gdkkeysyms.h always
+Fri May 15 21:16:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ Basic thread-awareness:
+
+ * acconfig.h configure.in: New option --with-threads=[yes/posix/no]
+
+ * gdk/Makefile.am gdk/gdkthreads.c: Added new functions
+ gdk_threads_[init/enter/leave] for applications, plus
+ gdk_threads_wake to wake the mainloop thread out of
+ the select().
+
+ * gtk/Makefile.am: gtk/testthreads.c: Test program for threads
+
+Fri May 15 12:08:48 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/testgtk.c (list_clear): Account for the fact
+ that gtk_list_clear_items is not inclusive. (Clears
+ [start, end))
+
Fri May 15 12:31:27 1998 rodo <doulik@karlin.mff.cuni.cz>
* gdk/gdk.c: include gdkkeysyms.h always
+Fri May 15 21:16:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ Basic thread-awareness:
+
+ * acconfig.h configure.in: New option --with-threads=[yes/posix/no]
+
+ * gdk/Makefile.am gdk/gdkthreads.c: Added new functions
+ gdk_threads_[init/enter/leave] for applications, plus
+ gdk_threads_wake to wake the mainloop thread out of
+ the select().
+
+ * gtk/Makefile.am: gtk/testthreads.c: Test program for threads
+
+Fri May 15 12:08:48 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/testgtk.c (list_clear): Account for the fact
+ that gtk_list_clear_items is not inclusive. (Clears
+ [start, end))
+
Fri May 15 12:31:27 1998 rodo <doulik@karlin.mff.cuni.cz>
* gdk/gdk.c: include gdkkeysyms.h always
+Fri May 15 21:16:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ Basic thread-awareness:
+
+ * acconfig.h configure.in: New option --with-threads=[yes/posix/no]
+
+ * gdk/Makefile.am gdk/gdkthreads.c: Added new functions
+ gdk_threads_[init/enter/leave] for applications, plus
+ gdk_threads_wake to wake the mainloop thread out of
+ the select().
+
+ * gtk/Makefile.am: gtk/testthreads.c: Test program for threads
+
+Fri May 15 12:08:48 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/testgtk.c (list_clear): Account for the fact
+ that gtk_list_clear_items is not inclusive. (Clears
+ [start, end))
+
Fri May 15 12:31:27 1998 rodo <doulik@karlin.mff.cuni.cz>
* gdk/gdk.c: include gdkkeysyms.h always
+Fri May 15 21:16:54 1998 Owen Taylor <otaylor@gtk.org>
+
+ Basic thread-awareness:
+
+ * acconfig.h configure.in: New option --with-threads=[yes/posix/no]
+
+ * gdk/Makefile.am gdk/gdkthreads.c: Added new functions
+ gdk_threads_[init/enter/leave] for applications, plus
+ gdk_threads_wake to wake the mainloop thread out of
+ the select().
+
+ * gtk/Makefile.am: gtk/testthreads.c: Test program for threads
+
+Fri May 15 12:08:48 1998 Owen Taylor <otaylor@gtk.org>
+
+ * gtk/testgtk.c (list_clear): Account for the fact
+ that gtk_list_clear_items is not inclusive. (Clears
+ [start, end))
+
Fri May 15 12:31:27 1998 rodo <doulik@karlin.mff.cuni.cz>
* gdk/gdk.c: include gdkkeysyms.h always
#undef RESOURCE_BASE
+/* Define to enable POSIX threading awareness */
+#undef USE_PTHREADS
+
#undef XINPUT_NONE
#undef XINPUT_GXI
#undef XINPUT_XFREE
#undef RESOURCE_BASE
+/* Define to enable POSIX threading awareness */
+#undef USE_PTHREADS
+
#undef XINPUT_NONE
#undef XINPUT_GXI
#undef XINPUT_XFREE
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
+AC_ARG_WITH(threads, [ --with-threads=[posix] support threading ])
if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
AC_DEFINE(XINPUT_NONE)
fi
+# Threads
+
+if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
+ AC_CHECK_LIB(pthread, pthread_create,
+ AC_DEFINE(USE_PTHREADS)
+ x_libs="$x_libs -lpthread"
+ CFLAGS="$CFLAGS -D_REENTRANT")
+fi
+
AC_SUBST(x_cflags)
AC_SUBST(x_includes)
AC_SUBST(x_ldflags)
gdkrectangle.c \
gdkregion.c \
gdkselection.c \
+ gdkthreads.c \
gdkvisual.c \
gdkwindow.c \
gdkxid.c \
max_input = MAX (max_input, input->source);
}
+#ifdef USE_PTHREADS
+ if (gdk_using_threads)
+ {
+ gdk_select_waiting = TRUE;
+
+ FD_SET (gdk_threads_pipe[0], &readfds);
+ max_input = MAX (max_input, gdk_threads_pipe[0]);
+ gdk_threads_leave ();
+ }
+#endif
+
nfd = select (max_input+1, &readfds, &writefds, &exceptfds, timerp);
+#ifdef USE_PTHREADS
+ if (gdk_using_threads)
+ {
+ gchar c;
+ gdk_threads_enter ();
+ gdk_select_waiting = FALSE;
+
+ if (FD_ISSET (gdk_threads_pipe[0], &readfds))
+ read (gdk_threads_pipe[0], &c, 1);
+ }
+#endif
+
timerp = NULL;
timer_val = 0;
GdkRegion* gdk_regions_xor (GdkRegion *source1,
GdkRegion *source2);
+gboolean gdk_threads_init (void);
+void gdk_threads_enter (void);
+void gdk_threads_leave (void);
+
+/* If the mainloop thread is in its select, wake it up.
+ * For GTK's idle handling
+ */
+void gdk_threads_wake (void);
#ifdef __cplusplus
}
#include <X11/Xlib.h>
#include "gdktypes.h"
#include "gdkprivate.h"
+#include "../config.h"
guint gdk_debug_flags = 0;
gint gdk_use_xshm = TRUE;
gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GList *gdk_default_filters = NULL;
+
+gboolean gdk_using_threads = FALSE;
+
+/* Used to signal the mainloop thread from its select() */
+#ifdef USE_PTHREADS
+gint gdk_threads_pipe[2];
+gboolean gdk_select_waiting = FALSE;
+#endif
+
+
extern gint gdk_error_warnings;
extern gint gdk_null_window_warnings;
extern GList *gdk_default_filters;
+extern gboolean gdk_using_threads;
+
+/* Threading stuff */
+#ifdef USE_PTHREADS
+extern gint gdk_threads_pipe[2];
+extern gboolean gdk_select_waiting;
+#endif
/* Debugging support */
#include <X11/Xlib.h>
#include "gdktypes.h"
#include "gdkprivate.h"
+#include "../config.h"
guint gdk_debug_flags = 0;
gint gdk_use_xshm = TRUE;
gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GList *gdk_default_filters = NULL;
+
+gboolean gdk_using_threads = FALSE;
+
+/* Used to signal the mainloop thread from its select() */
+#ifdef USE_PTHREADS
+gint gdk_threads_pipe[2];
+gboolean gdk_select_waiting = FALSE;
+#endif
+
+
max_input = MAX (max_input, input->source);
}
+#ifdef USE_PTHREADS
+ if (gdk_using_threads)
+ {
+ gdk_select_waiting = TRUE;
+
+ FD_SET (gdk_threads_pipe[0], &readfds);
+ max_input = MAX (max_input, gdk_threads_pipe[0]);
+ gdk_threads_leave ();
+ }
+#endif
+
nfd = select (max_input+1, &readfds, &writefds, &exceptfds, timerp);
+#ifdef USE_PTHREADS
+ if (gdk_using_threads)
+ {
+ gchar c;
+ gdk_threads_enter ();
+ gdk_select_waiting = FALSE;
+
+ if (FD_ISSET (gdk_threads_pipe[0], &readfds))
+ read (gdk_threads_pipe[0], &c, 1);
+ }
+#endif
+
timerp = NULL;
timer_val = 0;
INCLUDES = -I$(top_srcdir) -I../glib -I$(top_srcdir)/glib @x_cflags@
-noinst_PROGRAMS = testgtk testinput testselection simple
+noinst_PROGRAMS = testgtk testinput testselection testthreads simple
# FIXME, we currently rely on linking against libglib-1.1
testgtk_DEPENDENCIES = $(DEPS)
testinput_DEPENDENCIES = $(DEPS)
+testthreads_DEPENDENCIES = $(DEPS)
testselection_DEPENDENCIES = $(DEPS)
simple_DEPENDENCIES = $(DEPS)
testgtk_LDADD = $(LDADDS)
testinput_LDADD = $(LDADDS)
+testthreads_LDADD = $(LDADDS)
testselection_LDADD = $(LDADDS)
simple_LDADD = $(LDADDS)
idlef->data = data;
idlef->destroy = destroy;
+ /* If we are adding the first idle function, possibly wake up
+ * the main thread out of its select().
+ */
+ if (!idle_functions)
+ gdk_threads_wake ();
+
idle_functions = g_list_insert_sorted (idle_functions, idlef, gtk_idle_compare);
+
return idlef->tag;
}
list_clear (GtkWidget *widget,
GtkWidget *list)
{
- gtk_list_clear_items (GTK_LIST (list), 3 - 1, 5 - 1);
+ gtk_list_clear_items (GTK_LIST (list), 3 - 1, 6 - 1);
}
static void
list_clear (GtkWidget *widget,
GtkWidget *list)
{
- gtk_list_clear_items (GTK_LIST (list), 3 - 1, 5 - 1);
+ gtk_list_clear_items (GTK_LIST (list), 3 - 1, 6 - 1);
}
static void