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/DecoderThread.cxx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/DecoderThread.cxx') diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx index 4d0d008ca..a02bd9ee6 100644 --- a/src/DecoderThread.cxx +++ b/src/DecoderThread.cxx @@ -440,8 +440,8 @@ decoder_run(struct decoder_control *dc) } -static gpointer -decoder_task(gpointer arg) +static void +decoder_task(void *arg) { struct decoder_control *dc = (struct decoder_control *)arg; @@ -476,23 +476,16 @@ decoder_task(gpointer arg) } while (dc->command != DecoderCommand::NONE || !dc->quit); dc->Unlock(); - - return NULL; } void decoder_thread_start(struct decoder_control *dc) { - assert(dc->thread == NULL); + assert(!dc->thread.IsDefined()); 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) - FatalError("Failed to spawn decoder task", e); -#endif + Error error; + if (!dc->thread.Start(decoder_task, dc, error)) + FatalError(error); } -- cgit v1.2.3