changeset 215:84162f8f2164 trunk

[svn] GThreadify output plugin.
author chainsaw
date Sun, 20 Nov 2005 12:35:42 -0800
parents 03d9180e3c87
children f31b2fc0f49d
files Plugins/Output/alsa/audio.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Output/alsa/audio.c	Sun Nov 20 11:18:16 2005 -0800
+++ b/Plugins/Output/alsa/audio.c	Sun Nov 20 12:35:42 2005 -0800
@@ -31,7 +31,6 @@
 
 #include "alsa.h"
 #include <ctype.h>
-#include <pthread.h>
 #include <libaudacious/xconvert.h>
 
 static snd_pcm_t *alsa_pcm;
@@ -58,7 +57,7 @@
 static gboolean alsa_can_pause;
 
 /* for audio thread */
-static pthread_t audio_thread;	 /* audio loop thread */
+static GThread *audio_thread;	 /* audio loop thread */
 static int thread_buffer_size;	 /* size of intermediate buffer in bytes */
 static char *thread_buffer;	 /* audio intermediate buffer */
 static int rd_index, wr_index;	 /* current read/write position in int-buffer */
@@ -261,7 +260,7 @@
 
 	going = 0;
 
-	pthread_join(audio_thread, NULL);
+	g_thread_join(audio_thread);
 
 	alsa_cleanup_mixer();
 
@@ -851,7 +850,7 @@
 	alsa_close_pcm();
 	g_free(thread_buffer);
 	thread_buffer = NULL;
-	pthread_exit(NULL);
+	g_thread_exit(NULL);
 }
 
 /* open callback */
@@ -897,7 +896,7 @@
 	pause_request = FALSE;
 	flush_request = -1;
 	
-	pthread_create(&audio_thread, NULL, alsa_loop, NULL);
+	audio_thread = g_thread_create((GThreadFunc)alsa_loop, NULL, TRUE, NULL);
 	return 1;
 }