diff options
author | Kirill Belokurov <kirill.belokurov@gmail.com> | 2007-07-27 22:24:01 +0300 |
---|---|---|
committer | Kirill Belokurov <kirill.belokurov@gmail.com> | 2007-07-27 22:24:01 +0300 |
commit | 7c671e1d523f7707ddaa1d7d7111ffca58772bf4 (patch) | |
tree | c7b51434ec54218b0c61e410914f5a26387c682e | |
parent | d27eb600c51ce69d45468865f3fa3c3fd84df05c (diff) | |
download | xine-lib-7c671e1d523f7707ddaa1d7d7111ffca58772bf4.tar.gz xine-lib-7c671e1d523f7707ddaa1d7d7111ffca58772bf4.tar.bz2 |
Fixed race, reordered broadcaster shutdown sequence to avoid multiple access to connections list
-rw-r--r-- | src/xine-engine/broadcaster.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 30cdadc7c..43390ede5 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -352,6 +352,17 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) void _x_close_broadcaster(broadcaster_t *this) { + this->running = 0; + pthread_cancel(this->manager_thread); + pthread_join(this->manager_thread,NULL); + close(this->msock); + + if (this->stream->video_fifo) + this->stream->video_fifo->unregister_put_cb(this->stream->video_fifo, video_put_cb); + + if(this->stream->audio_fifo) + this->stream->audio_fifo->unregister_put_cb(this->stream->audio_fifo, audio_put_cb); + xine_list_iterator_t ite; while ( (ite = xine_list_front(this->connections)) ) { @@ -362,18 +373,9 @@ void _x_close_broadcaster(broadcaster_t *this) xine_list_remove (this->connections, ite); } xine_list_delete(this->connections); - - this->running = 0; - close(this->msock); - pthread_mutex_lock( &this->lock ); - pthread_cancel(this->manager_thread); - pthread_join(this->manager_thread,NULL); - - this->stream->video_fifo->unregister_put_cb(this->stream->video_fifo, video_put_cb); - if(this->stream->audio_fifo) - this->stream->audio_fifo->unregister_put_cb(this->stream->audio_fifo, audio_put_cb); - + pthread_mutex_destroy( &this->lock ); + free(this); } |