aboutsummaryrefslogtreecommitdiffstats
path: root/src/IOThread.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-17 01:49:43 +0200
committerMax Kellermann <max@duempel.org>2013-04-17 01:49:43 +0200
commita4a13a382525527afeecd18f97e948bd6d0de64c (patch)
tree19af72f5bfb5dc9dae8e82e7ff3c9d99b2c88335 /src/IOThread.cxx
parenta28df6123fef2047ec631d13c91156def6f7ab83 (diff)
downloadmpd-a4a13a382525527afeecd18f97e948bd6d0de64c.tar.gz
mpd-a4a13a382525527afeecd18f97e948bd6d0de64c.tar.xz
mpd-a4a13a382525527afeecd18f97e948bd6d0de64c.zip
use g_thread_new() if GLib is recent enough
Fixes deprecation warnings.
Diffstat (limited to 'src/IOThread.cxx')
-rw-r--r--src/IOThread.cxx10
1 files changed, 7 insertions, 3 deletions
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;
}