From 7e1601a85ba1f6640c717a02a64a136da23e7165 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 30 Oct 2002 17:51:13 +0000 Subject: - add mutex on seeking and avoid overuse of sched_yield CVS patchset: 3102 CVS date: 2002/10/30 17:51:13 --- src/xine-engine/demux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/xine-engine/demux.c') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 56917e71b..222a293e4 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -159,7 +159,8 @@ static void *demux_loop (void *stream_gen) { /* someone may want to interrupt us */ pthread_mutex_unlock( &stream->demux_lock ); - sched_yield(); + if( stream->demux_action_pending ) + sched_yield(); pthread_mutex_lock( &stream->demux_lock ); } @@ -231,8 +232,10 @@ int xine_demux_stop_thread (xine_stream_t *stream) { printf ("demux: stop thread called\n"); #endif + stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); stream->demux_thread_running = 0; + stream->demux_action_pending = 0; pthread_mutex_unlock( &stream->demux_lock ); #ifdef LOG -- cgit v1.2.3