diff options
author | Michael Meeks <michael@ximian.com> | 2003-12-08 17:13:13 +0000 |
---|---|---|
committer | Michael Meeks <michael@src.gnome.org> | 2003-12-08 17:13:13 +0000 |
commit | fa3ca01b174f561727c2f3c7e90195d009de983d (patch) | |
tree | 9b0528761f7936d883f539240e02ea7122b56a65 /gdk/gdk.h | |
parent | 47f63b8cb2ddd82a78137063c1dd5c99ee63eb03 (diff) | |
download | gtk+-fa3ca01b174f561727c2f3c7e90195d009de983d.tar.gz |
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.
Diffstat (limited to 'gdk/gdk.h')
-rw-r--r-- | gdk/gdk.h | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -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() |