use g_thread_new() if GLib is recent enough

Fixes deprecation warnings.
This commit is contained in:
Max Kellermann
2013-04-17 01:49:43 +02:00
parent a28df6123f
commit a4a13a3825
5 changed files with 26 additions and 9 deletions

View File

@@ -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
}