[vlc-commits] demux/adaptive: Downloader: prevent data-race on destruction
Filip Roséen
git at videolan.org
Thu May 18 21:09:06 CEST 2017
vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 17:07:33 2017 +0200| [17cc6f076ea040e47c74fb0f24c9e89f0afe3d44] | committer: Jean-Baptiste Kempf
demux/adaptive: Downloader: prevent data-race on destruction
Writing to killed needs to be protected by the mutex, there is also a
possibility of losing the sent signal unless we do it while the mutex
is acquired (a signal is not a semaphore).
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=17cc6f076ea040e47c74fb0f24c9e89f0afe3d44
---
modules/demux/adaptive/http/Downloader.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modules/demux/adaptive/http/Downloader.cpp b/modules/demux/adaptive/http/Downloader.cpp
index 3d7e7c2e2f..afce4597ed 100644
--- a/modules/demux/adaptive/http/Downloader.cpp
+++ b/modules/demux/adaptive/http/Downloader.cpp
@@ -50,8 +50,11 @@ bool Downloader::start()
Downloader::~Downloader()
{
+ vlc_mutex_lock( &lock );
killed = true;
vlc_cond_signal(&waitcond);
+ vlc_mutex_unlock( &lock );
+
if(thread_handle_valid)
vlc_join(thread_handle, NULL);
vlc_mutex_destroy(&lock);
More information about the vlc-commits
mailing list