aboutsummaryrefslogtreecommitdiffstats
path: root/src/IOThread.cxx
diff options
context:
space:
mode:
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;
}