[vorbis-dev] ogg123 1.0rc3 thread issue

Christian Weisgerber naddy at mips.inka.de
Fri Jan 18 18:41:22 PST 2002



As I have mentioned here before, ogg123 from 1.0rc3 segfaults after
playing a file on FreeBSD and OpenBSD.  This happens with both the
native pthread and with GNU pth.  I have finally managed to isolate
the problem.

ogg123 crashes inside pthread_cond_wait(), specifically in the
COND_WAIT() call in buffer_wait_for_empty().

*If* I understand the control flow correctly, the decoder thread
waits on a condition variable here that has already been removed
by the other thread winding down in buffer_thread_cleanup().  This
would result in "undefined behavior".

Removing the pthread_*_destroy() calls from buffer_thread_cleanup()
eliminates the crash.

--- ogg123/buffer.c.orig	Thu Dec 20 01:24:53 2001
+++ ogg123/buffer.c	Wed Jan 16 03:26:15 2002
@@ -88,9 +88,11 @@
 
   /* Cleanup thread data structures */
   pthread_mutex_unlock(&buf->mutex);
+#if 0	/* KLUDGE: disabling this keeps ogg123 from crashing */
   pthread_mutex_destroy(&buf->mutex);
   pthread_cond_destroy(&buf->playback_cond);
   pthread_cond_destroy(&buf->write_cond);
+#endif
 }

<p>
-- 
Christian "naddy" Weisgerber                          naddy at mips.inka.de

--- >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 'vorbis-dev-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 Vorbis-dev mailing list