forked from AuroraMiddleware/gtk
Based on a patch by Martin Kretzschmar; #122448
2003-12-02 Michael Meeks <michael@ximian.com> Based on a patch by Martin Kretzschmar; #122448 * gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE. (GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock function pointers. Deprecate the global gdk_threads_mutex variable. * gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new, extracted from GTK_THREADS_ENTER/LEAVE macros. (gdk_threads_init): init gtk_threads_[un]lock if not set. (gdk_threads_set_lock_functions): impl. * gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
This commit is contained in:
parent
47f63b8cb2
commit
fa3ca01b17
24
ChangeLog
24
ChangeLog
@ -1,3 +1,19 @@
|
||||
2003-12-02 Michael Meeks <michael@ximian.com>
|
||||
|
||||
Based on a patch by Martin Kretzschmar; #122448
|
||||
|
||||
* gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
|
||||
implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
|
||||
(GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
|
||||
function pointers. Deprecate the global gdk_threads_mutex variable.
|
||||
|
||||
* gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
|
||||
extracted from GTK_THREADS_ENTER/LEAVE macros.
|
||||
(gdk_threads_init): init gtk_threads_[un]lock if not set.
|
||||
(gdk_threads_set_lock_functions): impl.
|
||||
|
||||
* gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
|
||||
|
||||
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
|
||||
@ -544,7 +560,7 @@ Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
|
||||
label for the empty list. String change. (#95446, Tomas Ögren)
|
||||
label for the empty list. String change. (#95446, Tomas Ãgren)
|
||||
|
||||
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
@ -4449,7 +4465,7 @@ Fri Jun 6 11:07:33 2003 Owen Taylor <otaylor@redhat.com>
|
||||
* gtk/gtkwidget.c (event_window_still_viewable):
|
||||
Before delivering an event to a widget, check that
|
||||
(if relevant), the event's window is still viewable.
|
||||
(#105642, Dennis Björklund)
|
||||
(#105642, Dennis Björklund)
|
||||
|
||||
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
|
||||
NULL out private->parent, since after destruction
|
||||
@ -4598,7 +4614,7 @@ Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
#107883, Gustavo Giráldez
|
||||
#107883, Gustavo Giráldez
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
|
||||
Split out the case where we know we changed, and
|
||||
@ -5930,7 +5946,7 @@ Mon Jan 27 22:43:11 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
|
||||
out if the level only has one item, recurse over the child if there
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
|
||||
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-12-02 Michael Meeks <michael@ximian.com>
|
||||
|
||||
Based on a patch by Martin Kretzschmar; #122448
|
||||
|
||||
* gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
|
||||
implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
|
||||
(GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
|
||||
function pointers. Deprecate the global gdk_threads_mutex variable.
|
||||
|
||||
* gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
|
||||
extracted from GTK_THREADS_ENTER/LEAVE macros.
|
||||
(gdk_threads_init): init gtk_threads_[un]lock if not set.
|
||||
(gdk_threads_set_lock_functions): impl.
|
||||
|
||||
* gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
|
||||
|
||||
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
|
||||
@ -544,7 +560,7 @@ Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
|
||||
label for the empty list. String change. (#95446, Tomas Ögren)
|
||||
label for the empty list. String change. (#95446, Tomas Ãgren)
|
||||
|
||||
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
@ -4449,7 +4465,7 @@ Fri Jun 6 11:07:33 2003 Owen Taylor <otaylor@redhat.com>
|
||||
* gtk/gtkwidget.c (event_window_still_viewable):
|
||||
Before delivering an event to a widget, check that
|
||||
(if relevant), the event's window is still viewable.
|
||||
(#105642, Dennis Björklund)
|
||||
(#105642, Dennis Björklund)
|
||||
|
||||
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
|
||||
NULL out private->parent, since after destruction
|
||||
@ -4598,7 +4614,7 @@ Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
#107883, Gustavo Giráldez
|
||||
#107883, Gustavo Giráldez
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
|
||||
Split out the case where we know we changed, and
|
||||
@ -5930,7 +5946,7 @@ Mon Jan 27 22:43:11 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
|
||||
out if the level only has one item, recurse over the child if there
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
|
||||
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-12-02 Michael Meeks <michael@ximian.com>
|
||||
|
||||
Based on a patch by Martin Kretzschmar; #122448
|
||||
|
||||
* gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
|
||||
implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
|
||||
(GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
|
||||
function pointers. Deprecate the global gdk_threads_mutex variable.
|
||||
|
||||
* gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
|
||||
extracted from GTK_THREADS_ENTER/LEAVE macros.
|
||||
(gdk_threads_init): init gtk_threads_[un]lock if not set.
|
||||
(gdk_threads_set_lock_functions): impl.
|
||||
|
||||
* gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
|
||||
|
||||
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
|
||||
@ -544,7 +560,7 @@ Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
|
||||
label for the empty list. String change. (#95446, Tomas Ögren)
|
||||
label for the empty list. String change. (#95446, Tomas Ãgren)
|
||||
|
||||
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
@ -4449,7 +4465,7 @@ Fri Jun 6 11:07:33 2003 Owen Taylor <otaylor@redhat.com>
|
||||
* gtk/gtkwidget.c (event_window_still_viewable):
|
||||
Before delivering an event to a widget, check that
|
||||
(if relevant), the event's window is still viewable.
|
||||
(#105642, Dennis Björklund)
|
||||
(#105642, Dennis Björklund)
|
||||
|
||||
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
|
||||
NULL out private->parent, since after destruction
|
||||
@ -4598,7 +4614,7 @@ Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
#107883, Gustavo Giráldez
|
||||
#107883, Gustavo Giráldez
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
|
||||
Split out the case where we know we changed, and
|
||||
@ -5930,7 +5946,7 @@ Mon Jan 27 22:43:11 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
|
||||
out if the level only has one item, recurse over the child if there
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
|
||||
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-12-02 Michael Meeks <michael@ximian.com>
|
||||
|
||||
Based on a patch by Martin Kretzschmar; #122448
|
||||
|
||||
* gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
|
||||
implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
|
||||
(GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
|
||||
function pointers. Deprecate the global gdk_threads_mutex variable.
|
||||
|
||||
* gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
|
||||
extracted from GTK_THREADS_ENTER/LEAVE macros.
|
||||
(gdk_threads_init): init gtk_threads_[un]lock if not set.
|
||||
(gdk_threads_set_lock_functions): impl.
|
||||
|
||||
* gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
|
||||
|
||||
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
|
||||
@ -544,7 +560,7 @@ Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
|
||||
label for the empty list. String change. (#95446, Tomas Ögren)
|
||||
label for the empty list. String change. (#95446, Tomas Ãgren)
|
||||
|
||||
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
@ -4449,7 +4465,7 @@ Fri Jun 6 11:07:33 2003 Owen Taylor <otaylor@redhat.com>
|
||||
* gtk/gtkwidget.c (event_window_still_viewable):
|
||||
Before delivering an event to a widget, check that
|
||||
(if relevant), the event's window is still viewable.
|
||||
(#105642, Dennis Björklund)
|
||||
(#105642, Dennis Björklund)
|
||||
|
||||
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
|
||||
NULL out private->parent, since after destruction
|
||||
@ -4598,7 +4614,7 @@ Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
#107883, Gustavo Giráldez
|
||||
#107883, Gustavo Giráldez
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
|
||||
Split out the case where we know we changed, and
|
||||
@ -5930,7 +5946,7 @@ Mon Jan 27 22:43:11 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
|
||||
out if the level only has one item, recurse over the child if there
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
|
||||
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
2003-12-02 Michael Meeks <michael@ximian.com>
|
||||
|
||||
Based on a patch by Martin Kretzschmar; #122448
|
||||
|
||||
* gdk/gdk.h: new gdk_threads_lock, gdk_threads_unlock, point to
|
||||
implementation of GDK_THREADS_ENTER / GDK_THREADS_LEAVE.
|
||||
(GDK_THREADS_ENTER, GDK_THREADS_LEAVE): use gdk_threads_[un]lock
|
||||
function pointers. Deprecate the global gdk_threads_mutex variable.
|
||||
|
||||
* gdk/gdk.c (gdk_threads_impl_lock, gdk_threads_impl_unlock): new,
|
||||
extracted from GTK_THREADS_ENTER/LEAVE macros.
|
||||
(gdk_threads_init): init gtk_threads_[un]lock if not set.
|
||||
(gdk_threads_set_lock_functions): impl.
|
||||
|
||||
* gdk/gdkglobals.c: add definitions of gdk_threads_[un]lock.
|
||||
|
||||
Sun Dec 7 23:45:40 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkicontheme.c (gtk_icon_theme_has_icon): Don't crash if
|
||||
@ -544,7 +560,7 @@ Wed Nov 12 21:40:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
Wed Nov 12 21:00:10 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkinputdialog.c (gtk_input_dialog_init): Clarify the
|
||||
label for the empty list. String change. (#95446, Tomas Ögren)
|
||||
label for the empty list. String change. (#95446, Tomas Ãgren)
|
||||
|
||||
Wed Nov 12 20:57:50 2003 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
@ -4449,7 +4465,7 @@ Fri Jun 6 11:07:33 2003 Owen Taylor <otaylor@redhat.com>
|
||||
* gtk/gtkwidget.c (event_window_still_viewable):
|
||||
Before delivering an event to a widget, check that
|
||||
(if relevant), the event's window is still viewable.
|
||||
(#105642, Dennis Björklund)
|
||||
(#105642, Dennis Björklund)
|
||||
|
||||
* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy):
|
||||
NULL out private->parent, since after destruction
|
||||
@ -4598,7 +4614,7 @@ Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
#107883, Gustavo Giráldez
|
||||
#107883, Gustavo Giráldez
|
||||
|
||||
* gtk/gtktextlayout.c (gtk_text_layout_emit_changed):
|
||||
Split out the case where we know we changed, and
|
||||
@ -5930,7 +5946,7 @@ Mon Jan 27 22:43:11 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_sort_helper): don't just bail
|
||||
out if the level only has one item, recurse over the child if there
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
is one. (Fixes #100458, reported by Gaël Le Mignot).
|
||||
|
||||
Mon Jan 27 22:41:26 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
|
56
gdk/gdk.c
56
gdk/gdk.c
@ -495,6 +495,20 @@ gdk_threads_leave ()
|
||||
GDK_THREADS_LEAVE ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_threads_impl_lock (void)
|
||||
{
|
||||
if (gdk_threads_mutex)
|
||||
g_mutex_lock (gdk_threads_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_threads_impl_unlock (void)
|
||||
{
|
||||
if (gdk_threads_mutex)
|
||||
g_mutex_unlock (gdk_threads_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_threads_init:
|
||||
*
|
||||
@ -512,6 +526,48 @@ gdk_threads_init ()
|
||||
g_error ("g_thread_init() must be called before gdk_threads_init()");
|
||||
|
||||
gdk_threads_mutex = g_mutex_new ();
|
||||
if (!gdk_threads_lock)
|
||||
gdk_threads_lock = gdk_threads_impl_lock;
|
||||
if (!gdk_threads_unlock)
|
||||
gdk_threads_unlock = gdk_threads_impl_unlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_threads_set_lock_functions:
|
||||
* @enter_fn: function called to guard gtk+
|
||||
* @leave_fn: function called to release the guard
|
||||
*
|
||||
* Allows the application to replace the standard method that
|
||||
* GDK uses to protect its data structures. Normally, GDK
|
||||
* creates a single #GMutex that is locked by gdk_threads_enter(),
|
||||
* and released by gdk_threads_leave(); using this function an
|
||||
* application provides, instead, a function @enter_fn that is
|
||||
* called by gdk_threads_enter() and a function @leave_fn that is
|
||||
* called by gdk_threads_leave().
|
||||
*
|
||||
* The functions must provide at least same locking functionality
|
||||
* as the default implementation, but can also do extra application
|
||||
* specific processing.
|
||||
*
|
||||
* As an example, consider an application that has its own recursive
|
||||
* lock that when held, holds the GTK+ lock as well. When GTK+ unlocks
|
||||
* the GTK+ lock when entering a recursive main loop, the application
|
||||
* must temporarily release its lock as well.
|
||||
*
|
||||
* Most threaded GTK+ apps won't need to use this method.
|
||||
*
|
||||
* This method must be called before gdk_threads_init, and cannot
|
||||
* be called multiple times.
|
||||
**/
|
||||
void
|
||||
gdk_threads_set_lock_functions (GCallback enter_fn,
|
||||
GCallback leave_fn)
|
||||
{
|
||||
g_return_if_fail (gdk_threads_lock == NULL &&
|
||||
gdk_threads_unlock == NULL);
|
||||
|
||||
gdk_threads_lock = enter_fn;
|
||||
gdk_threads_unlock = leave_fn;
|
||||
}
|
||||
|
||||
G_CONST_RETURN char *
|
||||
|
19
gdk/gdk.h
19
gdk/gdk.h
@ -171,20 +171,27 @@ void gdk_notify_startup_complete (void);
|
||||
/* Threading
|
||||
*/
|
||||
|
||||
GDKVAR GMutex *gdk_threads_mutex;
|
||||
#if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION)
|
||||
GDKVAR GMutex *gdk_threads_mutex; /* private */
|
||||
#endif
|
||||
|
||||
GDKVAR GCallback gdk_threads_lock;
|
||||
GDKVAR GCallback gdk_threads_unlock;
|
||||
|
||||
void gdk_threads_enter (void);
|
||||
void gdk_threads_leave (void);
|
||||
void gdk_threads_init (void);
|
||||
void gdk_threads_init (void);
|
||||
void gdk_threads_set_lock_functions (GCallback enter_fn,
|
||||
GCallback leave_fn);
|
||||
|
||||
#ifdef G_THREADS_ENABLED
|
||||
# define GDK_THREADS_ENTER() G_STMT_START { \
|
||||
if (gdk_threads_mutex) \
|
||||
g_mutex_lock (gdk_threads_mutex); \
|
||||
if (gdk_threads_lock) \
|
||||
(*gdk_threads_lock) (); \
|
||||
} G_STMT_END
|
||||
# define GDK_THREADS_LEAVE() G_STMT_START { \
|
||||
if (gdk_threads_mutex) \
|
||||
g_mutex_unlock (gdk_threads_mutex); \
|
||||
if (gdk_threads_unlock) \
|
||||
(*gdk_threads_unlock) (); \
|
||||
} G_STMT_END
|
||||
#else /* !G_THREADS_ENABLED */
|
||||
# define GDK_THREADS_ENTER()
|
||||
|
@ -40,5 +40,6 @@ gchar *_gdk_display_arg_name = NULL;
|
||||
|
||||
GSList *_gdk_displays = NULL;
|
||||
|
||||
GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
|
||||
|
||||
GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
|
||||
GCallback gdk_threads_lock = NULL;
|
||||
GCallback gdk_threads_unlock = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user