[glom] Avoid calling g_thread_init() if possible.



commit 492690ed6b7a18a860b119fc81ea255364ea2033
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Oct 21 11:33:44 2011 +0200

    Avoid calling g_thread_init() if possible.
    
    * configure.ac: Add a comment about not linking to gthread-2.0 in future.
    * glom/libglom/init.cc:
    * tests/import/test_parsing.cc:
    * tests/import/test_signals.cc: Avoid calls to deprecated Glib::thread_init()
    if glib is new enough.
    This is a step to making Glom build against glibmm from git master with
    --enable-warnings=fatal.

 ChangeLog                    |   12 ++++++++++++
 configure.ac                 |    2 ++
 glom/libglom/init.cc         |    4 ++++
 tests/import/test_parsing.cc |    5 +++++
 tests/import/test_signals.cc |    5 +++++
 5 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f80351a..a491d1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-10-21  Murray Cumming  <murrayc murrayc com>
+
+	Avoid calling g_thread_init() if possible.
+
+	* configure.ac: Add a comment about not linking to gthread-2.0 in future.
+	* glom/libglom/init.cc:
+	* tests/import/test_parsing.cc:
+	* tests/import/test_signals.cc: Avoid calls to deprecated Glib::thread_init()
+	if glib is new enough.
+	This is a step to making Glom build against glibmm from git master with
+	--enable-warnings=fatal.
+
 2011-10-20  Murray Cumming  <murrayc murrayc com>
 
 	libglom: Restore the Util::build_sql_select_count_row() API. 
diff --git a/configure.ac b/configure.ac
index 1b52480..8b242a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,6 +131,8 @@ AS_IF([test "x$glom_enable_postgresql" = xyes],
                  [Whether to enable support for PostgreSQL databases.])])
 
 # Libraries used by libglom:
+# TODO: Remove the need for gthread-2.0 when we can depend on giomm (or glibmm) 3.32,
+# because gthread-2.0 is then just an empty unnecessary library.
 REQUIRED_LIBGLOM_LIBS='gthread-2.0 giomm-2.4 libxml++-2.6 >= 2.23.1 libxslt >= 1.1.10 pygobject-3.0 >= 2.29.0 libgdamm-5.0 >= 4.99.4 libgda-postgres-5.0'
 
 AS_IF([test "x$glom_host_win32" != xyes],
diff --git a/glom/libglom/init.cc b/glom/libglom/init.cc
index 4d55048..5d13475 100644
--- a/glom/libglom/init.cc
+++ b/glom/libglom/init.cc
@@ -45,8 +45,12 @@ namespace Glom
 
 void libglom_init()
 {
+  //Threading is always enabled starting from GLib 2.31.0:
+  //TODO: Just remove this when we can increase the glibmm version needed:
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   if (!Glib::thread_supported())
     Glib::thread_init(0); //So we can use GMutex.
+#endif
 
   Gnome::Gda::init();
   Gio::init();
diff --git a/tests/import/test_parsing.cc b/tests/import/test_parsing.cc
index e26b4b7..128c072 100644
--- a/tests/import/test_parsing.cc
+++ b/tests/import/test_parsing.cc
@@ -84,7 +84,12 @@ void connect_signals(Glom::CsvParser& parser)
 // Testcases
 int main()
 {
+  //Threading is always enabled starting from GLib 2.31.0:
+  //TODO: Just remove this when we can increase the glibmm version needed:
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   Glib::thread_init();
+#endif
+
   Glib::init();
   Gio::init();
 
diff --git a/tests/import/test_signals.cc b/tests/import/test_signals.cc
index 456da48..ec798c3 100644
--- a/tests/import/test_signals.cc
+++ b/tests/import/test_signals.cc
@@ -57,7 +57,12 @@ void connect_signals(Glom::CsvParser& parser)
 // Testcases
 int main()
 {
+  //Threading is always enabled starting from GLib 2.31.0:
+  //TODO: Just remove this when we can increase the glibmm version needed:
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   Glib::thread_init();
+#endif
+
   Glib::init();
   Gio::init();
 



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