diff options
author | Thibaut Mattern <tmattern@users.sourceforge.net> | 2005-03-06 11:08:40 +0000 |
---|---|---|
committer | Thibaut Mattern <tmattern@users.sourceforge.net> | 2005-03-06 11:08:40 +0000 |
commit | 4be4c9d1bbf057f7117e286bede19f599138030d (patch) | |
tree | 709646988a4ca6671cbeea0325d00ef969c1ecda /src/xine-engine/demux.c | |
parent | 2cd0a3433ae8f07e7211d2c7b34e17a27de49a26 (diff) | |
download | xine-lib-4be4c9d1bbf057f7117e286bede19f599138030d.tar.gz xine-lib-4be4c9d1bbf057f7117e286bede19f599138030d.tar.bz2 |
Fixed pthread leak, the demuxer thread was not joined in all cases.
See this thread for more info:
http://thread.gmane.org/gmane.comp.video.xine.devel/12377
CVS patchset: 7432
CVS date: 2005/03/06 11:08:40
Diffstat (limited to 'src/xine-engine/demux.c')
-rw-r--r-- | src/xine-engine/demux.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index ff0b78a1d..b7a3f4dbc 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -20,7 +20,7 @@ * Demuxer helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $Id: demux.c,v 1.55 2005/02/10 11:33:31 mroi Exp $ + * $Id: demux.c,v 1.56 2005/03/06 11:08:40 tmattern Exp $ */ @@ -317,7 +317,6 @@ static void *demux_loop (void *stream_gen) { pthread_mutex_unlock (&stream->counter_lock); _x_handle_stream_end(stream, non_user); - stream->demux_thread = 0; return NULL; } @@ -332,7 +331,9 @@ int _x_demux_start_thread (xine_stream_t *stream) { stream->demux_action_pending = 0; if( !stream->demux_thread_running ) { - + + _x_assert(stream->demux_thread == 0); + stream->demux_thread_running = 1; if ((err = pthread_create (&stream->demux_thread, NULL, demux_loop, (void *)stream)) != 0) { @@ -364,8 +365,10 @@ int _x_demux_stop_thread (xine_stream_t *stream) { lprintf ("joining thread %ld\n", stream->demux_thread ); - if( stream->demux_thread ) + if( stream->demux_thread ) { pthread_join (stream->demux_thread, &p); + stream->demux_thread = 0; + } /* * Wake up xine_play if it's waiting for a frame |