aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/DecoderThread.cxx7
-rw-r--r--src/IOThread.cxx10
-rw-r--r--src/OutputThread.cxx7
-rw-r--r--src/PlayerThread.cxx4
-rw-r--r--src/UpdateGlue.cxx7
5 files changed, 26 insertions, 9 deletions
diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx
index 18bbad6df..fdc900abd 100644
--- a/src/DecoderThread.cxx
+++ b/src/DecoderThread.cxx
@@ -494,13 +494,16 @@ decoder_task(gpointer arg)
void
decoder_thread_start(struct decoder_control *dc)
{
- GError *e = NULL;
-
assert(dc->thread == NULL);
dc->quit = false;
+#if GLIB_CHECK_VERSION(2,32,0)
+ dc->thread = g_thread_new("thread", decoder_task, dc);
+#else
+ GError *e = NULL;
dc->thread = g_thread_create(decoder_task, dc, true, &e);
if (dc->thread == NULL)
MPD_ERROR("Failed to spawn decoder task: %s", e->message);
+#endif
}
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;
}
diff --git a/src/OutputThread.cxx b/src/OutputThread.cxx
index 734c5783c..d072b50cd 100644
--- a/src/OutputThread.cxx
+++ b/src/OutputThread.cxx
@@ -673,10 +673,13 @@ static gpointer audio_output_task(gpointer arg)
void audio_output_thread_start(struct audio_output *ao)
{
- GError *e = NULL;
-
assert(ao->command == AO_COMMAND_NONE);
+#if GLIB_CHECK_VERSION(2,32,0)
+ ao->thread = g_thread_new("output", audio_output_task, ao);
+#else
+ GError *e = nullptr;
if (!(ao->thread = g_thread_create(audio_output_task, ao, true, &e)))
MPD_ERROR("Failed to spawn output task: %s\n", e->message);
+#endif
}
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index 2d8e6caaf..ccf16bb39 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -1202,8 +1202,12 @@ player_create(struct player_control *pc)
{
assert(pc->thread == NULL);
+#if GLIB_CHECK_VERSION(2,32,0)
+ pc->thread = g_thread_new("player", player_task, pc);
+#else
GError *e = NULL;
pc->thread = g_thread_create(player_task, pc, true, &e);
if (pc->thread == NULL)
MPD_ERROR("Failed to spawn player task: %s", e->message);
+#endif
}
diff --git a/src/UpdateGlue.cxx b/src/UpdateGlue.cxx
index 664638782..e9906b84a 100644
--- a/src/UpdateGlue.cxx
+++ b/src/UpdateGlue.cxx
@@ -99,16 +99,19 @@ static void * update_task(void *_path)
static void
spawn_update_task(const char *path)
{
- GError *e = NULL;
-
assert(g_thread_self() == main_task);
progress = UPDATE_PROGRESS_RUNNING;
modified = false;
+#if GLIB_CHECK_VERSION(2,32,0)
+ update_thr = g_thread_new("updadte", update_task, g_strdup(path));
+#else
+ GError *e = NULL;
update_thr = g_thread_create(update_task, g_strdup(path), TRUE, &e);
if (update_thr == NULL)
MPD_ERROR("Failed to spawn update task: %s", e->message);
+#endif
if (++update_task_id > update_task_id_max)
update_task_id = 1;