diff options
author | Thomas Jansen <mithi@mithi.net> | 2008-12-28 22:09:38 +0100 |
---|---|---|
committer | Thomas Jansen <mithi@mithi.net> | 2008-12-28 22:09:38 +0100 |
commit | 195cec505e56c59eefee14ec6fb7bc193cbdaf06 (patch) | |
tree | 2c1ea90397f8b8aa53db15454d285067d5bfc580 /src | |
parent | c01ad37d3bb9b8d801b91f3a02caba8c461f88e4 (diff) | |
download | mpd-195cec505e56c59eefee14ec6fb7bc193cbdaf06.tar.gz mpd-195cec505e56c59eefee14ec6fb7bc193cbdaf06.tar.xz mpd-195cec505e56c59eefee14ec6fb7bc193cbdaf06.zip |
player_thread: migrate from pthread to glib threads
Diffstat (limited to 'src')
-rw-r--r-- | src/player_thread.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index a831bae3b..d588a079b 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -493,7 +493,7 @@ static void do_play(void) player_stop_decoder(); } -static void * player_task(G_GNUC_UNUSED void *arg) +static gpointer player_task(G_GNUC_UNUSED gpointer arg) { while (1) { switch (pc.command) { @@ -517,7 +517,7 @@ static void * player_task(G_GNUC_UNUSED void *arg) dc_quit(&pc.notify); closeAudioDevice(); player_command_finished(); - pthread_exit(NULL); + g_thread_exit(NULL); break; case PLAYER_COMMAND_CANCEL: @@ -535,11 +535,9 @@ static void * player_task(G_GNUC_UNUSED void *arg) void player_create(void) { - pthread_attr_t attr; - pthread_t player_thread; + GError *e; + GThread *t; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - if (pthread_create(&player_thread, &attr, player_task, NULL)) - FATAL("Failed to spawn player task: %s\n", strerror(errno)); + if (!(t = g_thread_create(player_task, NULL, FALSE, &e))) + FATAL("Failed to spawn player task: %s\n", e->message); } |