From a4a13a382525527afeecd18f97e948bd6d0de64c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 17 Apr 2013 01:49:43 +0200 Subject: use g_thread_new() if GLib is recent enough Fixes deprecation warnings. --- src/IOThread.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/IOThread.cxx') diff --git a/src/IOThread.cxx b/src/IOThread.cxx index 192d4cc49..bbd4b9c3c 100644 --- a/src/IOThread.cxx +++ b/src/IOThread.cxx @@ -64,16 +64,20 @@ io_thread_init(void) } bool -io_thread_start(GError **error_r) +io_thread_start(gcc_unused GError **error_r) { assert(io.loop != NULL); assert(io.thread == NULL); - io.mutex.lock(); + const ScopeLock protect(io.mutex); + +#if GLIB_CHECK_VERSION(2,32,0) + io.thread = g_thread_new("io", io_thread_func, nullptr); +#else io.thread = g_thread_create(io_thread_func, NULL, true, error_r); - io.mutex.unlock(); if (io.thread == NULL) return false; +#endif return true; } -- cgit v1.2.3