Commit c01ad37d authored by Thomas Jansen's avatar Thomas Jansen

decoder_thread: migrate from pthread to glib threads

parent bfb5657d
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "log.h" #include "log.h"
#include "ls.h" #include "ls.h"
#include <pthread.h>
#include <glib.h> #include <glib.h>
static bool static bool
...@@ -203,7 +202,7 @@ static void decoder_run(void) ...@@ -203,7 +202,7 @@ static void decoder_run(void)
dc.state = ret ? DECODE_STATE_STOP : DECODE_STATE_ERROR; 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 { do {
assert(dc.state == DECODE_STATE_STOP || assert(dc.state == DECODE_STATE_STOP ||
...@@ -234,11 +233,9 @@ static void * decoder_task(G_GNUC_UNUSED void *arg) ...@@ -234,11 +233,9 @@ static void * decoder_task(G_GNUC_UNUSED void *arg)
void decoder_thread_start(void) void decoder_thread_start(void)
{ {
pthread_attr_t attr; GError *e;
pthread_t decoder_thread; GThread *t;
pthread_attr_init(&attr); if (!(t = g_thread_create(decoder_task, NULL, FALSE, &e)))
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); FATAL("Failed to spawn decoder task: %s\n", e->message);
if (pthread_create(&decoder_thread, &attr, decoder_task, NULL))
FATAL("Failed to spawn decoder task: %s\n", strerror(errno));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment