diff options
author | Max Kellermann <max@duempel.org> | 2013-10-17 18:42:14 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-17 19:29:47 +0200 |
commit | 8e676db633aa8888c8408a91ef219d2261ef42e2 (patch) | |
tree | 9e61e37ab5d181e90e89c5d4ced99c3434b3976c /src/DecoderThread.cxx | |
parent | f6d74012b7a583bddf2e3b824193ade91fe09ce7 (diff) | |
download | mpd-8e676db633aa8888c8408a91ef219d2261ef42e2.tar.gz mpd-8e676db633aa8888c8408a91ef219d2261ef42e2.tar.xz mpd-8e676db633aa8888c8408a91ef219d2261ef42e2.zip |
Thread/Thread: replacement library for GThread
Diffstat (limited to '')
-rw-r--r-- | src/DecoderThread.cxx | 19 |
1 files changed, 6 insertions, 13 deletions
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); } |