mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-23 10:27:51 +02:00
2003-02-14 Sebastian Wilhelmi <seppi@seppi.de> Fixes for #101264 and #99372: * glib/gconvert.h, glib/gmain.c, glib/gmem.c, glib/gmessages.c, glib/grand.c: Include gthreadinit.h and rename the thread initialization functions a bit and let them start with _, so that later we can stop exporting them. * glib/gmem.c, glib/gmessages.c: Move the g_private_new() calls to new functions. They have to be called after setting g_threads_got_initialized to TRUE (see #101264). * glib/gthread.c: Include gthreadinit.h. Renamed g_mutex_init() to g_thread_init_glib(). Call the thread initialization functions (which are not allowed to call g_private_new), then set g_threads_got_initialized to TRUE, then call the other thread initialization functions (which must not call anything but g_private_new()). * glib/gthreadinit.h: New private header to cleanly declare all thread initialization functions. * gthread/gthread-impl.c: Include gthreadinit.h. In g_thread_init() just call g_thread_init_glib(), which in turn calls the other functions (see #99372). * glib/Makefile.am: Added gthreadinit.h.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
f0e22eaadf
commit
8e91cf9eb9
@@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include <gthreadinit.h>
|
||||
|
||||
#ifdef G_THREADS_ENABLED
|
||||
|
||||
@@ -336,9 +337,6 @@ g_thread_init (GThreadFunctions* init)
|
||||
|
||||
g_thread_functions_for_glib_use = *init;
|
||||
|
||||
/* It is important, that g_threads_got_initialized is not set before the
|
||||
* thread initialization functions of the different modules are called
|
||||
*/
|
||||
supported = (init->mutex_new &&
|
||||
init->mutex_lock &&
|
||||
init->mutex_trylock &&
|
||||
@@ -376,24 +374,7 @@ g_thread_init (GThreadFunctions* init)
|
||||
g_thread_priority_map [G_THREAD_PRIORITY_HIGH] = PRIORITY_HIGH_VALUE;
|
||||
g_thread_priority_map [G_THREAD_PRIORITY_URGENT] = PRIORITY_URGENT_VALUE;
|
||||
|
||||
/* now call the thread initialization functions of the different
|
||||
* glib modules. order does matter, g_mutex_init MUST come first.
|
||||
*/
|
||||
g_mutex_init ();
|
||||
g_mem_init ();
|
||||
g_messages_init ();
|
||||
g_convert_init ();
|
||||
g_rand_init ();
|
||||
|
||||
/* now we can set g_threads_got_initialized and thus enable
|
||||
* all the thread functions
|
||||
*/
|
||||
g_threads_got_initialized = TRUE;
|
||||
|
||||
/* This has to come after g_threads_got_initialized is set
|
||||
* since it uses a private variable created by g_mem_init()
|
||||
*/
|
||||
g_main_thread_init ();
|
||||
g_thread_init_glib ();
|
||||
}
|
||||
|
||||
#else /* !G_THREADS_ENABLED */
|
||||
|
Reference in New Issue
Block a user