[gnome-games] libgames-support: Assert that threads are initialised



commit 2c4630161ac46385b156af6691df9916463a5bfc
Author: Christian Persch <chpe gnome org>
Date:   Sat Jul 18 22:29:58 2009 +0200

    libgames-support: Assert that threads are initialised
    
    For libgames-support.la, init threads. For libgames-support-gi.la, assert
    that threads are initialised as seed has already inited threads before.

 libgames-support/Makefile.am     |    2 +-
 libgames-support/games-runtime.c |   11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/libgames-support/Makefile.am b/libgames-support/Makefile.am
index 6330525..3c6e7c6 100644
--- a/libgames-support/Makefile.am
+++ b/libgames-support/Makefile.am
@@ -356,7 +356,7 @@ if HAVE_INTROSPECTION
 pkglib_LTLIBRARIES += libgames-support-gi.la
 
 libgames_support_gi_la_SOURCES = $(libgames_support_la_SOURCES) $(nodist_libgames_support_la_SOURCES)
-libgames_support_gi_la_CPPFLAGS = $(libgames_support_la_CPPFLAGS)
+libgames_support_gi_la_CPPFLAGS = $(libgames_support_la_CPPFLAGS) -DLIBGAMES_SUPPORT_GI
 libgames_support_gi_la_CFLAGS = $(libgames_support_la_CFLAGS)
 libgames_support_gi_la_LIBADD = $(libgames_support_la_LIBADD)
 
diff --git a/libgames-support/games-runtime.c b/libgames-support/games-runtime.c
index b399d3f..f4e998e 100644
--- a/libgames-support/games-runtime.c
+++ b/libgames-support/games-runtime.c
@@ -350,11 +350,14 @@ games_runtime_init (const char *name)
   /* If we're going to use gconf, gnome-vfs, or canberra, we need to
    * init threads; and this has to be done before calling any other glib functions.
    */
-  if(!g_thread_get_initialized()) {
-    g_thread_init (NULL);
-  }
-  /* May call any glib function after this point */
+#if defined(LIBGAMES_SUPPORT_GI)
+  /* Seed has already called g_thread_init() */
+  g_assert (g_thread_get_initialized());
+#else
+  g_thread_init (NULL);
 #endif
+#endif
+  /* May call any glib function after this point */
 
   _games_profile_start ("games_runtime_init");
 



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