summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuergen Keil <jkeil@users.sourceforge.net>2002-10-30 13:59:11 +0000
committerJuergen Keil <jkeil@users.sourceforge.net>2002-10-30 13:59:11 +0000
commitc0a6fe55488467a5ceaeb2073b99e9503b3031db (patch)
tree3a68c6233d37324fb397366f50a8e376df6a05eb /src
parent150b1c4e7585d4bfb4f1106d54360a8de95bc450 (diff)
downloadxine-lib-c0a6fe55488467a5ceaeb2073b99e9503b3031db.tar.gz
xine-lib-c0a6fe55488467a5ceaeb2073b99e9503b3031db.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/demux.c2
1 files changed, 2 insertions, 0 deletions
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 <stdio.h>
#include <string.h>
#include <pthread.h>
+#include <sched.h>
#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 );
}