diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-10-22 12:59:21 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-10-22 12:59:21 +0000 |
commit | 97ff064f22cdfef8abf620eb6900da6163e9b734 (patch) | |
tree | e0d8caf60b48b2af01646560980fad71ecd5db17 /gdk | |
parent | 3d3d570d7711efd049e92cfb80b12b4d0d255318 (diff) | |
download | gtk+-97ff064f22cdfef8abf620eb6900da6163e9b734.tar.gz |
Add a function, gdk_threads_init() that must be explicitely called to
Mon Oct 22 08:51:02 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.[ch] (gdk_threads_init) docs/Changes-2.0.txt:
Add a function, gdk_threads_init() that must be explicitely
called to enable the GDK thread mutex.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdk.c | 23 | ||||
-rw-r--r-- | gdk/gdk.h | 1 |
2 files changed, 21 insertions, 3 deletions
@@ -279,9 +279,6 @@ gdk_init_check (int *argc, if (gdk_initialized) return TRUE; - if (g_thread_supported ()) - gdk_threads_mutex = g_mutex_new (); - if (argc && argv) { argc_orig = *argc; @@ -514,6 +511,26 @@ gdk_threads_leave () GDK_THREADS_LEAVE (); } +/** + * gdk_threads_init: + * + * Initializes GDK so that it can be used from multiple threads + * in conjunction with gdk_threads_enter() and gdk_threads_leave(). + * If g_thread_init() has not yet been called, calls + * g_thread_init(NULL). + * + * This call must be made before any use of the main loop from + * GTK+; to be safe, call it before gtk_init(). + **/ +void +gdk_threads_init () +{ + if (!g_thread_supported ()) + g_thread_init (NULL); + + gdk_threads_mutex = g_mutex_new (); +} + G_CONST_RETURN char * gdk_get_program_class (void) { @@ -151,6 +151,7 @@ GDKVAR GMutex *gdk_threads_mutex; void gdk_threads_enter (void); void gdk_threads_leave (void); +void gdk_threads_init (void); #ifdef G_THREADS_ENABLED # define GDK_THREADS_ENTER() G_STMT_START { \ |