aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Jansen <mithi@mithi.net>2008-12-28 22:09:33 +0100
committerThomas Jansen <mithi@mithi.net>2008-12-28 22:09:33 +0100
commitc01ad37d3bb9b8d801b91f3a02caba8c461f88e4 (patch)
tree7e37251c89788eb849e6a0ca7df6c627bdc5cf0b
parentbfb5657d6d34d199b7b3408434e5b397bed976d6 (diff)
downloadmpd-c01ad37d3bb9b8d801b91f3a02caba8c461f88e4.tar.gz
mpd-c01ad37d3bb9b8d801b91f3a02caba8c461f88e4.tar.xz
mpd-c01ad37d3bb9b8d801b91f3a02caba8c461f88e4.zip
decoder_thread: migrate from pthread to glib threads
Diffstat (limited to '')
-rw-r--r--src/decoder_thread.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 093c67f90..de82cb6d3 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -28,7 +28,6 @@
#include "log.h"
#include "ls.h"
-#include <pthread.h>
#include <glib.h>
static bool
@@ -203,7 +202,7 @@ static void decoder_run(void)
dc.state = ret ? DECODE_STATE_STOP : DECODE_STATE_ERROR;
}
-static void * decoder_task(G_GNUC_UNUSED void *arg)
+static gpointer decoder_task(G_GNUC_UNUSED gpointer arg)
{
do {
assert(dc.state == DECODE_STATE_STOP ||
@@ -234,11 +233,9 @@ static void * decoder_task(G_GNUC_UNUSED void *arg)
void decoder_thread_start(void)
{
- pthread_attr_t attr;
- pthread_t decoder_thread;
+ GError *e;
+ GThread *t;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&decoder_thread, &attr, decoder_task, NULL))
- FATAL("Failed to spawn decoder task: %s\n", strerror(errno));
+ if (!(t = g_thread_create(decoder_task, NULL, FALSE, &e)))
+ FATAL("Failed to spawn decoder task: %s\n", e->message);
}