[vlc-devel] [PATCH 3/6] demux/adaptive: Downloader: prevent data-race on destruction
Filip Roséen
filip at atch.se
Thu May 18 17:07:33 CEST 2017
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).
---
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 948f425879..5b909512fb 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);
--
2.12.2
More information about the vlc-devel
mailing list