changeset 181:2626212fdad4 trunk

[svn] GThreadify this input plugin.
author chainsaw
date Sun, 13 Nov 2005 13:33:03 -0800
parents 7b98cea0bb49
children 728cbb7faa1f
files Plugins/Input/flac/configure.c Plugins/Input/flac/http.c Plugins/Input/flac/plugin.c
diffstat 3 files changed, 8 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/flac/configure.c	Sun Nov 13 13:27:38 2005 -0800
+++ b/Plugins/Input/flac/configure.c	Sun Nov 13 13:33:03 2005 -0800
@@ -25,7 +25,6 @@
 #include <string.h>
 #include <glib.h>
 #include <gtk/gtk.h>
-#include <pthread.h>
 #include <math.h>
 
 #include <libaudacious/configfile.h>
--- a/Plugins/Input/flac/http.c	Sun Nov 13 13:27:38 2005 -0800
+++ b/Plugins/Input/flac/http.c	Sun Nov 13 13:33:03 2005 -0800
@@ -30,8 +30,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <pthread.h>
-
 #include <audacious/util.h>
 #include <audacious/plugin.h>
 
@@ -66,7 +64,7 @@
 static guint64 buffer_read = 0;
 static gchar *buffer;
 static guint64 offset;
-static pthread_t thread;
+static GThread *thread;
 static GtkWidget *error_dialog = NULL;
 
 static FILE *output_file = NULL;
@@ -187,7 +185,7 @@
 {
 	going = FALSE;
 
-	pthread_join(thread, NULL);
+	g_thread_join(thread);
 	g_free(icy_name);
 	icy_name = NULL;
 }
@@ -699,7 +697,7 @@
 	g_free(buffer);
 	g_free(url);
 	
-	pthread_exit(NULL);
+	g_thread_exit(NULL);
 	return NULL; /* avoid compiler warning */
 }
 
@@ -721,7 +719,7 @@
 	buffer = g_malloc(buffer_length);
 	offset = _offset;
 
-	pthread_create(&thread, NULL, http_buffer_loop, url);
+	thread = g_thread_create((GThreadFunc)http_buffer_loop, url, TRUE, NULL);
 
 	return 0;
 }
--- a/Plugins/Input/flac/plugin.c	Sun Nov 13 13:27:38 2005 -0800
+++ b/Plugins/Input/flac/plugin.c	Sun Nov 13 13:33:03 2005 -0800
@@ -16,7 +16,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -166,7 +165,7 @@
 
 static void *decoder_ = 0;
 static file_info_struct file_info_;
-static pthread_t decode_thread_;
+static GThread *decode_thread_;
 static FLAC__bool audio_error_ = false;
 static FLAC__bool is_big_endian_host_;
 
@@ -368,7 +367,7 @@
 
 	file_info_.seek_to_in_sec = -1;
 	file_info_.play_thread_open = true;
-	pthread_create(&decode_thread_, NULL, play_loop_, NULL);
+	decode_thread_ = g_thread_create((GThreadFunc)play_loop_, NULL, TRUE, NULL);
 }
 
 void FLAC_XMMS__stop()
@@ -377,7 +376,7 @@
 		file_info_.is_playing = false;
 		if(file_info_.play_thread_open) {
 			file_info_.play_thread_open = false;
-			pthread_join(decode_thread_, NULL);
+			g_thread_join(decode_thread_);
 		}
 		flac_ip.output->close_audio();
 		decoder_func_table_ -> safe_decoder_finish (decoder_);
@@ -545,7 +544,7 @@
 
 	g_free(file_info_.title);
 
-	pthread_exit(NULL);
+	g_thread_exit(NULL);
 	return 0; /* to silence the compiler warning about not returning a value */
 }