changeset 969:0ee1070d1741 trunk

[svn] - Properly wait for the flac decoder thread to finish
author ertzing
date Fri, 20 Apr 2007 13:29:12 -0700
parents 317a7a8c002d
children 64409f979799
files ChangeLog src/flacng/Makefile src/flacng/plugin.c
diffstat 3 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 20 07:42:53 2007 -0700
+++ b/ChangeLog	Fri Apr 20 13:29:12 2007 -0700
@@ -1,3 +1,12 @@
+2007-04-20 14:42:53 +0000  Ralf Ertzinger <ralf@skytale.net>
+  revision [2076]
+  
+  - Rename flacng debug flag to FLACNG_DEBUG
+  
+  trunk/src/flacng/debug.h |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2007-04-20 14:41:13 +0000  Ralf Ertzinger <ralf@skytale.net>
   revision [2074]
   
--- a/src/flacng/Makefile	Fri Apr 20 07:42:53 2007 -0700
+++ b/src/flacng/Makefile	Fri Apr 20 13:29:12 2007 -0700
@@ -11,6 +11,6 @@
 
 OBJECTS = ${SOURCES:.c=.o}
 
-CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I../../intl -I../.. -I./libflac $(FLAC_CFLAGS)
+CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I../../intl -I../.. -I./libflac $(FLAC_CFLAGS) -DFLACNG_DEBUG
 
 include ../../mk/objective.mk
--- a/src/flacng/plugin.c	Fri Apr 20 07:42:53 2007 -0700
+++ b/src/flacng/plugin.c	Fri Apr 20 13:29:12 2007 -0700
@@ -67,7 +67,7 @@
 callback_info* main_info;
 gboolean plugin_initialized = FALSE;
 gint seek_to = -1;
-static GThread* thread;
+static GThread* thread = NULL;
 GMutex* flac_pl_mutex;
 
 /* === */
@@ -590,6 +590,16 @@
 
     input->playing = FALSE;
 
+    if (NULL != thread) {
+        /*
+         * Wait for the decoder thread to finish
+         */
+        _DEBUG("Waiting for decoder thread to die...");
+        g_thread_join(thread);
+        thread = NULL;
+        _DEBUG("Decoder thread has finished");
+    }
+
     _LEAVE;
 }