[xiph-cvs] cvs commit: vorbis-tools/ogg123 buffer.c

Segher Boessenkool segher at xiph.org
Sat Jan 19 01:30:38 PST 2002



segher      02/01/19 01:30:37

  Modified:    ogg123   buffer.c
  Log:
  the mutex and the condition variables are not owned by the buffer thread,
  but by the buffer itself.  don't destroy them when the thread dies, but
  when the buffer itself dies.  fixes #112.

Revision  Changes    Path
1.14      +7 -7      vorbis-tools/ogg123/buffer.c

Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- buffer.c	2001/12/20 00:24:53	1.13
+++ buffer.c	2002/01/19 09:30:37	1.14
@@ -11,7 +11,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: buffer.c,v 1.13 2001/12/20 00:24:53 volsung Exp $
+ last mod: $Id: buffer.c,v 1.14 2002/01/19 09:30:37 segher Exp $
 
  ********************************************************************/
 
@@ -85,12 +85,6 @@
   buf_t *buf = (buf_t *)arg;
 
   DEBUG("Enter buffer_thread_cleanup");
-
-  /* Cleanup thread data structures */
-  pthread_mutex_unlock(&buf->mutex);
-  pthread_mutex_destroy(&buf->mutex);
-  pthread_cond_destroy(&buf->playback_cond);
-  pthread_cond_destroy(&buf->write_cond);
 }
 
 
@@ -430,6 +424,12 @@
 void buffer_destroy (buf_t *buf)
 {
   DEBUG("buffer_destroy");
+
+  /* Cleanup pthread variables */
+  pthread_mutex_destroy(&buf->mutex);
+  pthread_cond_destroy(&buf->write_cond);
+  pthread_cond_destroy(&buf->playback_cond);
+  
   free(buf);
 }
 

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list