summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2002-10-30 21:45:21 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2002-10-30 21:45:21 +0000
commit9427638de5ba5b995c5b8cdd495dbf5fd7144282 (patch)
tree322e6bd88a4149e0022fd8278c4f6864f11ec030 /src
parent7e1601a85ba1f6640c717a02a64a136da23e7165 (diff)
downloadxine-lib-9427638de5ba5b995c5b8cdd495dbf5fd7144282.tar.gz
xine-lib-9427638de5ba5b995c5b8cdd495dbf5fd7144282.tar.bz2
Avoid a potential deadlock.
CVS patchset: 3103 CVS date: 2002/10/30 21:45:21
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/demux.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index 222a293e4..4f7ee1dca 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -159,8 +159,12 @@ static void *demux_loop (void *stream_gen) {
/* someone may want to interrupt us */
pthread_mutex_unlock( &stream->demux_lock );
- if( stream->demux_action_pending )
+ if( stream->demux_action_pending ) {
+#ifdef LOG
+ printf ("demux: sched_yield\n");
+#endif
sched_yield();
+ }
pthread_mutex_lock( &stream->demux_lock );
}
@@ -253,5 +257,15 @@ int xine_demux_stop_thread (xine_stream_t *stream) {
pthread_mutex_unlock (&stream->counter_lock);
+ /*
+ * Wake up xine_play if it's waiting for a frame
+ */
+ pthread_mutex_lock (&stream->first_frame_lock);
+ if (stream->first_frame_flag) {
+ stream->first_frame_flag = 0;
+ pthread_cond_signal(&stream->first_frame_reached);
+ }
+ pthread_mutex_unlock (&stream->first_frame_lock);
+
return 0;
}