diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-03-07 15:29:30 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-03-07 15:29:30 +0000 |
commit | faf06d5ef4fbba98817ca1f863a9cfe8440f7265 (patch) | |
tree | 6c4ed123a66004d04bf48dd543851787dabd08c8 /src/xine-engine/audio_decoder.c | |
parent | 8e59691b2a3296f45355e8da5455bd203a64243d (diff) | |
download | xine-lib-faf06d5ef4fbba98817ca1f863a9cfe8440f7265.tar.gz xine-lib-faf06d5ef4fbba98817ca1f863a9cfe8440f7265.tar.bz2 |
workaround buggy pthread implementations with a timedwait
(thanks Ewald)
CVS patchset: 4358
CVS date: 2003/03/07 15:29:30
Diffstat (limited to 'src/xine-engine/audio_decoder.c')
-rw-r--r-- | src/xine-engine/audio_decoder.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 9d9bddf26..188a69466 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.103 2003/03/07 12:51:48 guenter Exp $ + * $Id: audio_decoder.c,v 1.104 2003/03/07 15:29:30 miguelfreitas Exp $ * * * functions that implement audio decoding @@ -116,7 +116,13 @@ void *audio_decoder_loop (void *stream_gen) { pthread_cond_broadcast (&stream->counter_changed); while (stream->finished_count_video < stream->finished_count_audio) { - pthread_cond_wait (&stream->counter_changed, &stream->counter_lock); + struct timeval tv; + struct timespec ts; + gettimeofday(&tv, NULL); + ts.tv_sec = tv.tv_sec + 1; + ts.tv_nsec = tv.tv_usec * 1000; + /* use timedwait to workaround buggy pthread broadcast implementations */ + pthread_cond_timedwait (&stream->counter_changed, &stream->counter_lock, &ts); } pthread_mutex_unlock (&stream->counter_lock); |