From 8e676db633aa8888c8408a91ef219d2261ef42e2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 17 Oct 2013 18:42:14 +0200 Subject: Thread/Thread: replacement library for GThread --- src/OutputThread.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/OutputThread.cxx') diff --git a/src/OutputThread.cxx b/src/OutputThread.cxx index a3a842df4..5b93b04e3 100644 --- a/src/OutputThread.cxx +++ b/src/OutputThread.cxx @@ -562,7 +562,8 @@ static void ao_pause(struct audio_output *ao) ao->pause = false; } -static gpointer audio_output_task(gpointer arg) +static void +audio_output_task(void *arg) { struct audio_output *ao = (struct audio_output *)arg; @@ -647,7 +648,7 @@ static gpointer audio_output_task(gpointer arg) ao->chunk = NULL; ao_command_finished(ao); ao->mutex.unlock(); - return NULL; + return; } if (ao->open && ao->allow_play && ao_play(ao)) @@ -664,11 +665,7 @@ void audio_output_thread_start(struct audio_output *ao) { 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))) - FatalError("Failed to spawn output task", e); -#endif + Error error; + if (!ao->thread.Start(audio_output_task, ao, error)) + FatalError(error); } -- cgit v1.2.3