diff options
author | Rainer Hochecker <fernetmenta@online.de> | 2018-07-23 17:06:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-23 17:06:43 +0200 |
commit | 298413c0be68d2c99f98e59f40d5c6d182d6531a (patch) | |
tree | edb36b4556cb73f28524d15cd0ef628f2d4c773c | |
parent | 721461b107de7a0fd16ee41c1e35ad3c7c3087f5 (diff) | |
parent | e4f4797549bb8baf26cc9bf2644c5be89b9b1c66 (diff) |
Merge pull request #13867 from FernetMenta/threads
make sure not to delete a CThread object while spawn thread is in pro…
-rw-r--r-- | xbmc/threads/Thread.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xbmc/threads/Thread.cpp b/xbmc/threads/Thread.cpp index 45f3ece553..4295aef196 100644 --- a/xbmc/threads/Thread.cpp +++ b/xbmc/threads/Thread.cpp @@ -40,7 +40,7 @@ static thread_local CThread* currentThread; ////////////////////////////////////////////////////////////////////// CThread::CThread(const char* ThreadName) -: m_StopEvent(true,true), m_TermEvent(true), m_StartEvent(true) +: m_StopEvent(true,true), m_TermEvent(true), m_StartEvent(true, true) { m_bStop = false; @@ -57,7 +57,7 @@ CThread::CThread(const char* ThreadName) } CThread::CThread(IRunnable* pRunnable, const char* ThreadName) -: m_StopEvent(true,true), m_TermEvent(true), m_StartEvent(true) +: m_StopEvent(true, true), m_TermEvent(true), m_StartEvent(true, true) { m_bStop = false; @@ -155,6 +155,8 @@ bool CThread::IsAutoDelete() const void CThread::StopThread(bool bWait /*= true*/) { + m_StartEvent.Wait(); + m_bStop = true; m_StopEvent.Set(); CSingleLock lock(m_CriticalSection); |