[libepc] Don't use g_thread_init() or g_thread_supported().



commit 66509deaeedf176c239686dbad7f9f778e60174c
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Oct 28 10:12:57 2015 +0100

    Don't use g_thread_init() or g_thread_supported().
    
    Threads are always supported since glib 2.32.

 configure.ac                          |    4 ++--
 examples/consumer-ui.c                |    2 --
 examples/list-resources.c             |    1 -
 examples/lookup-resource.c            |    1 -
 examples/publisher-ui.c               |    1 -
 examples/server-credentials.c         |    1 -
 examples/simple-publisher.c           |    1 -
 libepc/tls.c                          |   13 ++++---------
 tests/test-consumer-by-info.c         |    1 -
 tests/test-consumer-by-name.c         |    1 -
 tests/test-dispatcher-unique.c        |    1 -
 tests/test-publisher-bookmarks.c      |    1 -
 tests/test-publisher-change-name.c    |    1 -
 tests/test-publisher-libsoup-494128.c |    1 -
 tests/test-publisher-unique.c         |    1 -
 15 files changed, 6 insertions(+), 25 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 41a4a0e..a50d411 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,8 +72,8 @@ PKG_CHECK_EXISTS([$GIO_REQUIREMENT],
 PKG_CHECK_MODULES(AVAHI_UI,  [avahi-ui-gtk3     >= 0.6])
 PKG_CHECK_MODULES(LIBEPC,    [avahi-client >= 0.6
                               avahi-glib   >= 0.6
-                              glib-2.0     >= 2.12
-                              gthread-2.0  >= 2.12
+                              glib-2.0     >= 2.32
+                              gthread-2.0  >= 2.32
                               gmodule-2.0  >= 2.0
                               gobject-2.0  >= 2.4
                               gnutls       >= 1.4
diff --git a/examples/consumer-ui.c b/examples/consumer-ui.c
index bc2f8a6..39cbdcf 100644
--- a/examples/consumer-ui.c
+++ b/examples/consumer-ui.c
@@ -205,8 +205,6 @@ main (int   argc,
 
   /* Initialize the toolkit */
 
-  g_thread_init (NULL);
-
   if (!gtk_init_with_args (&argc, &argv, NULL, entries, NULL, &error))
     {
       g_print ("Usage error: %s\n", error->message);
diff --git a/examples/list-resources.c b/examples/list-resources.c
index 9f19543..996e89f 100644
--- a/examples/list-resources.c
+++ b/examples/list-resources.c
@@ -64,7 +64,6 @@ main (int   argc,
 
   /* Initialize the toolkit. */
 
-  g_thread_init (NULL);
   g_type_init ();
 
   /* Parse command line options. */
diff --git a/examples/lookup-resource.c b/examples/lookup-resource.c
index 5eacf29..e27bb98 100644
--- a/examples/lookup-resource.c
+++ b/examples/lookup-resource.c
@@ -67,7 +67,6 @@ main (int   argc,
 
   /* Initialize the toolkit. */
 
-  g_thread_init (NULL);
   g_type_init ();
 
   /* Parse command line options. */
diff --git a/examples/publisher-ui.c b/examples/publisher-ui.c
index 01839ba..807e90c 100644
--- a/examples/publisher-ui.c
+++ b/examples/publisher-ui.c
@@ -776,7 +776,6 @@ main (int   argc,
   GtkWidget *text_view;
   GtkWidget *main_window;
 
-  g_thread_init (NULL);
   g_set_application_name ("Easy Publisher Example");
 
   gtk_init (&argc, &argv);
diff --git a/examples/server-credentials.c b/examples/server-credentials.c
index 7fea3d0..8f0efc2 100644
--- a/examples/server-credentials.c
+++ b/examples/server-credentials.c
@@ -19,7 +19,6 @@ main (int   argc,
   /* Initialize GTK+ and gnutls
    */
   gnutls_global_init ();
-  g_thread_init (NULL);
   gtk_init (&argc, &argv);
 
   /* Show a progress window when generating new keys.
diff --git a/examples/simple-publisher.c b/examples/simple-publisher.c
index 7575b78..4e406e7 100644
--- a/examples/simple-publisher.c
+++ b/examples/simple-publisher.c
@@ -106,7 +106,6 @@ main (int   argc,
   /* Initialize the toolkit. */
 
   setlocale (LC_ALL, "");
-  g_thread_init (NULL);
   g_type_init ();
 
   /* Parse command line options. */
diff --git a/libepc/tls.c b/libepc/tls.c
index 1e882e8..9665908 100644
--- a/libepc/tls.c
+++ b/libepc/tls.c
@@ -175,15 +175,10 @@ epc_tls_private_key_new (GError **error)
   context.rc = gnutls_x509_privkey_init (&context.key);
   epc_tls_check (context.rc);
 
-  if (g_thread_supported ())
-    {
-      context.loop = g_main_loop_new (NULL, FALSE);
-      g_thread_create (epc_tls_private_key_thread, &context, FALSE, NULL);
-      g_main_loop_run (context.loop);
-      g_main_loop_unref (context.loop);
-    }
-  else
-    epc_tls_private_key_thread (&context);
+  context.loop = g_main_loop_new (NULL, FALSE);
+  g_thread_create (epc_tls_private_key_thread, &context, FALSE, NULL);
+  g_main_loop_run (context.loop);
+  g_main_loop_unref (context.loop);
 
   epc_tls_check (context.rc);
 
diff --git a/tests/test-consumer-by-info.c b/tests/test-consumer-by-info.c
index 452abce..9258bb1 100644
--- a/tests/test-consumer-by-info.c
+++ b/tests/test-consumer-by-info.c
@@ -85,7 +85,6 @@ main (void)
   gint result = 1;
 
   g_set_prgname (__FILE__);
-  g_thread_init (NULL);
   g_type_init ();
 
   if (!epc_test_init (5))
diff --git a/tests/test-consumer-by-name.c b/tests/test-consumer-by-name.c
index 0dd821b..b7eec08 100644
--- a/tests/test-consumer-by-name.c
+++ b/tests/test-consumer-by-name.c
@@ -35,7 +35,6 @@ main (void)
   gint result = 1;
 
   g_set_prgname (__FILE__);
-  g_thread_init (NULL);
   g_type_init ();
 
   publisher = epc_publisher_new (NULL, NULL, NULL);
diff --git a/tests/test-dispatcher-unique.c b/tests/test-dispatcher-unique.c
index f69f06a..ff2e42d 100644
--- a/tests/test-dispatcher-unique.c
+++ b/tests/test-dispatcher-unique.c
@@ -85,7 +85,6 @@ main (void)
   gint result = 1;
 
   g_set_prgname (__FILE__);
-  g_thread_init (NULL);
   g_type_init ();
 
   test_cookie1 = g_strdup_printf ("%08x-%08x-1", g_random_int (), g_random_int ());
diff --git a/tests/test-publisher-bookmarks.c b/tests/test-publisher-bookmarks.c
index 37f0aa7..9c4d8ce 100644
--- a/tests/test-publisher-bookmarks.c
+++ b/tests/test-publisher-bookmarks.c
@@ -74,7 +74,6 @@ main (int   argc G_GNUC_UNUSED,
   g_set_prgname (prgname);
   g_free (prgname);
 
-  g_thread_init (NULL);
   g_type_init ();
 
   hash = g_random_int ();
diff --git a/tests/test-publisher-change-name.c b/tests/test-publisher-change-name.c
index 0df50fb..22de352 100644
--- a/tests/test-publisher-change-name.c
+++ b/tests/test-publisher-change-name.c
@@ -69,7 +69,6 @@ main (int   argc G_GNUC_UNUSED,
   g_set_prgname (prgname);
   g_free (prgname);
 
-  g_thread_init (NULL);
   g_type_init ();
 
   hash = g_random_int ();
diff --git a/tests/test-publisher-libsoup-494128.c b/tests/test-publisher-libsoup-494128.c
index 2475332..bec4913 100644
--- a/tests/test-publisher-libsoup-494128.c
+++ b/tests/test-publisher-libsoup-494128.c
@@ -54,7 +54,6 @@ main (int   argc G_GNUC_UNUSED,
   g_set_prgname (prgname);
   g_free (prgname);
 
-  g_thread_init (NULL);
   g_type_init ();
 
   loop = g_main_loop_new (NULL, FALSE);
diff --git a/tests/test-publisher-unique.c b/tests/test-publisher-unique.c
index c85e3f5..f8b56e3 100644
--- a/tests/test-publisher-unique.c
+++ b/tests/test-publisher-unique.c
@@ -99,7 +99,6 @@ main (void)
   gint result = 1;
 
   g_set_prgname (__FILE__);
-  g_thread_init (NULL);
   g_type_init ();
 
   test_cookie = g_strdup_printf ("%08x-%08x", g_random_int (), g_random_int ());


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