pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 04/13] gui: Call g_thread_init() earlier.


From: Ben Pfaff
Subject: [PATCH 04/13] gui: Call g_thread_init() earlier.
Date: Mon, 16 Apr 2012 20:52:10 -0700

The GTK+ 2.20 manual says:

    The threading system is initialized with g_thread_init(), which takes
    an optional custom thread implementation or NULL for the default
    implementation. If you want to call g_thread_init() with a non-NULL
    argument this must be done before executing any other GLib functions
    (except g_mem_set_vtable()). This is a requirement even if no threads
    are in fact ever created by the process.

    Calling g_thread_init() with a NULL argument is somewhat more
    relaxed. You may call any other glib functions in the main thread
    before g_thread_init() as long as g_thread_init() is not called from a
    glib callback, or with any locks held. However, many libraries above
    glib does not support late initialization of threads, so doing this
    should be avoided if possible.

so I think that it's best to call g_thread_init() before
gtk_disable_setlocale() rather than after.
---
 src/ui/gui/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c
index eea71f8..5e0116b 100644
--- a/src/ui/gui/main.c
+++ b/src/ui/gui/main.c
@@ -278,10 +278,10 @@ main (int argc, char *argv[])
   set_program_name (argv[0]);
 
   g_mem_set_vtable (&vtable);
+  g_thread_init (NULL);
 
   gtk_disable_setlocale ();
 
-  g_thread_init (NULL);
   startup = g_timer_new ();
   g_timer_start (startup);
 
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]