From e38ce21e75368a33cd1d6965c9a5312fbd827816 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 3 Jan 2012 10:57:30 +0100 Subject: [PATCH] Port to glib 2.31.x g_thread API g_thread_init() is deprecated since glib 2.24, call g_type_init() instead. g_thread_create is deprecated since 2.31, use g_thread_new() instead. Bump glib requirement accordingly. https://bugs.freedesktop.org/show_bug.cgi?id=44413 --- configure.ac | 2 +- test/internals/refs.c | 68 +++++++++++++++++++----------------------------- 2 files changed, 28 insertions(+), 42 deletions(-) diff --git a/configure.ac b/configure.ac index 243cbbc..9c506d8 100644 --- a/configure.ac +++ b/configure.ac @@ -192,7 +192,7 @@ fi # default (unless you don't have GLib), because they don't bloat the library # or binaries. if test "x$enable_modular_tests" != xno; then - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22, gio-2.0 >= 2.22], + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.31.4, gio-2.0 >= 2.22], [], [if test "x$enable_modular_tests" = xyes; then AC_MSG_NOTICE([Full test coverage (--enable-modular-tests=yes or --enable-tests=yes) requires GLib]) diff --git a/test/internals/refs.c b/test/internals/refs.c index bc0884e..cc501d1 100644 --- a/test/internals/refs.c +++ b/test/internals/refs.c @@ -26,6 +26,7 @@ #include +#include #include #define DBUS_COMPILATION /* this test uses libdbus-internal */ @@ -276,10 +277,9 @@ test_connection (Fixture *f, for (i = 0; i < N_THREADS; i++) { if ((i % 2) == 0) - f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, ref_thread, &public_api); else - f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, ref_thread, &internal_api); g_assert (f->threads[i] != NULL); } @@ -289,11 +289,9 @@ test_connection (Fixture *f, for (i = 0; i < N_THREADS; i++) { if ((i % 2) == 0) - f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api); else - f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, &internal_api); g_assert (f->threads[i] != NULL); } @@ -303,11 +301,9 @@ test_connection (Fixture *f, for (i = 0; i < N_THREADS; i++) { if ((i % 2) == 0) - f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, &public_api); else - f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, &internal_api); g_assert (f->threads[i] != NULL); } @@ -360,10 +356,9 @@ test_server (Fixture *f, for (i = 0; i < N_THREADS; i++) { if ((i % 2) == 0) - f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, ref_thread, &public_api); else - f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, ref_thread, &internal_api); g_assert (f->threads[i] != NULL); } @@ -373,11 +368,9 @@ test_server (Fixture *f, for (i = 0; i < N_THREADS; i++) { if ((i % 2) == 0) - f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api); else - f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, &internal_api); g_assert (f->threads[i] != NULL); } @@ -387,11 +380,9 @@ test_server (Fixture *f, for (i = 0; i < N_THREADS; i++) { if ((i % 2) == 0) - f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, &public_api); else - f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, &internal_api); g_assert (f->threads[i] != NULL); } @@ -426,7 +417,7 @@ test_message (Fixture *f, for (i = 0; i < N_THREADS; i++) { - f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, ref_thread, &public_api); g_assert (f->threads[i] != NULL); } @@ -434,7 +425,7 @@ test_message (Fixture *f, for (i = 0; i < N_THREADS; i++) { - f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api); g_assert (f->threads[i] != NULL); } @@ -442,7 +433,7 @@ test_message (Fixture *f, for (i = 0; i < N_THREADS; i++) { - f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, &public_api); g_assert (f->threads[i] != NULL); } @@ -500,10 +491,9 @@ test_pending_call (Fixture *f, for (i = 0; i < N_THREADS; i++) { if ((i % 2) == 0) - f->threads[i] = g_thread_create (ref_thread, &public_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, ref_thread, &public_api); else - f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, ref_thread, &internal_api); g_assert (f->threads[i] != NULL); } @@ -515,16 +505,14 @@ test_pending_call (Fixture *f, switch (i % 3) { case 0: - f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api); break; case 1: - f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, &internal_api); break; default: - f->threads[i] = g_thread_create (cycle_thread, - &unref_and_unlock_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, cycle_thread, + &unref_and_unlock_api); } g_assert (f->threads[i] != NULL); @@ -537,16 +525,14 @@ test_pending_call (Fixture *f, switch (i % 3) { case 0: - f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, &public_api); break; case 1: - f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE, - NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, &internal_api); break; default: - f->threads[i] = g_thread_create (unref_thread, - &unref_and_unlock_api, TRUE, NULL); + f->threads[i] = g_thread_new (NULL, unref_thread, + &unref_and_unlock_api); } g_assert (f->threads[i] != NULL); @@ -595,7 +581,7 @@ int main (int argc, char **argv) { - g_thread_init (NULL); + g_type_init (); g_test_init (&argc, &argv, NULL); g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id="); -- 1.7.7.3