aboutsummaryrefslogtreecommitdiffstats
path: root/src/UpdateGlue.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-17 01:49:43 +0200
committerMax Kellermann <max@duempel.org>2013-04-17 01:49:43 +0200
commita4a13a382525527afeecd18f97e948bd6d0de64c (patch)
tree19af72f5bfb5dc9dae8e82e7ff3c9d99b2c88335 /src/UpdateGlue.cxx
parenta28df6123fef2047ec631d13c91156def6f7ab83 (diff)
downloadmpd-a4a13a382525527afeecd18f97e948bd6d0de64c.tar.gz
mpd-a4a13a382525527afeecd18f97e948bd6d0de64c.tar.xz
mpd-a4a13a382525527afeecd18f97e948bd6d0de64c.zip
use g_thread_new() if GLib is recent enough
Fixes deprecation warnings.
Diffstat (limited to 'src/UpdateGlue.cxx')
-rw-r--r--src/UpdateGlue.cxx7
1 files changed, 5 insertions, 2 deletions
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;