mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-25 03:17:52 +02:00
Enable threads in g_type_init()
This means threads will be supported for all gobject libraries/applications and initialized early enough to not cause any problems. This solves the problem of libraries needing threadsafety. Previosly they just called g_threads_init() anyway, which often works but sometimes breaks in unexpected ways. See this thread for more details: http://mail.gnome.org/archives/gtk-devel-list/2009-November/msg00208.html https://bugzilla.gnome.org/show_bug.cgi?id=606775
This commit is contained in:
@@ -4180,7 +4180,12 @@ g_type_init_with_debug_flags (GTypeDebugFlags debug_flags)
|
||||
GTypeInfo info;
|
||||
TypeNode *node;
|
||||
volatile GType votype;
|
||||
|
||||
|
||||
#ifdef G_THREADS_ENABLED
|
||||
if (!g_thread_get_initialized())
|
||||
g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
G_LOCK (type_init_lock);
|
||||
|
||||
G_WRITE_LOCK (&type_rw_lock);
|
||||
@@ -4284,6 +4289,8 @@ g_type_init_with_debug_flags (GTypeDebugFlags debug_flags)
|
||||
* to initialize the type system and assorted other code portions
|
||||
* (such as the various fundamental type implementations or the signal
|
||||
* system).
|
||||
*
|
||||
* Since version 2.24 this also initializes the thread system
|
||||
*/
|
||||
void
|
||||
g_type_init (void)
|
||||
|
Reference in New Issue
Block a user