From c0a6fe55488467a5ceaeb2073b99e9503b3031db Mon Sep 17 00:00:00 2001 From: Juergen Keil Date: Wed, 30 Oct 2002 13:59:11 +0000 Subject: Release the processor between the mutex unlock()/lock() sequence, to give xine_demux_stop_thread a chance to aquire the mutex, so that it can change stream->demux_thread_running to 0. Problem is, the demuxer thread has it's mutex blocked 99.9% of the time and releases it only for an extremely short time, for the purpose of allowing another thread to interrupt the demuxer. On Solaris at least, the unlock()/lock() sequence will typically run in the thread's allocated time slice and chances are mimimal that the demuxer is preempted between the unlock()/lock(), which would allow another thread to grab the mutex. CVS patchset: 3101 CVS date: 2002/10/30 13:59:11 --- src/xine-engine/demux.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index ddbb9017f..56917e71b 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "xine_internal.h" #include "demuxers/demux.h" #include "buffer.h" @@ -158,6 +159,7 @@ static void *demux_loop (void *stream_gen) { /* someone may want to interrupt us */ pthread_mutex_unlock( &stream->demux_lock ); + sched_yield(); pthread_mutex_lock( &stream->demux_lock ); } -- cgit v1.2.3