From: Lars Op den Kamp Date: Sat, 8 Oct 2011 15:34:23 +0000 (+0200) Subject: cec: fix possible deadlock when starting a new thread X-Git-Tag: upstream/2.2.0~1^2~270 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b5ed9b9ed6bf72799ccb58263856598e8ad6dab3;p=deb_libcec.git cec: fix possible deadlock when starting a new thread --- diff --git a/src/lib/platform/threads.cpp b/src/lib/platform/threads.cpp index 31a0fb3..8ba3919 100644 --- a/src/lib/platform/threads.cpp +++ b/src/lib/platform/threads.cpp @@ -175,10 +175,17 @@ void *CThread::ThreadHandler(CThread *thread) if (thread) { + CLockObject lock(&thread->m_threadMutex); thread->m_bRunning = true; + lock.Leave(); thread->m_threadCondition.Broadcast(); + retVal = thread->Process(); + + lock.Lock(); thread->m_bRunning = false; + lock.Leave(); + thread->m_threadCondition.Broadcast(); } return retVal;