cec: don't unlock the transmit mutex in CCECProcessor while waiting for an answer
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 6 Dec 2011 15:40:14 +0000 (16:40 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 6 Dec 2011 15:40:14 +0000 (16:40 +0100)
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h

index 974273916cda249d242d30209a39554c94a5bd28..9f8dc9d30c0b9f970e72546309bd650500b97dc6 100644 (file)
@@ -166,7 +166,7 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command)
 
   if (bHandled && !bHandlerChanged)
   {
-    CLockObject lock(&m_processor->m_transmitMutex);
+    CLockObject lock(&m_receiveMutex);
     m_condition.Signal();
   }
 
@@ -899,10 +899,11 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /*
     command.retries = m_iTransmitRetries;
 
   CLockObject writeLock(&m_processor->m_transmitMutex);
+  CLockObject receiveLock(&m_receiveMutex);
   if (m_processor->Transmit(command))
   {
     if (bExpectResponse)
-      return m_condition.Wait(&m_processor->m_transmitMutex, m_iTransmitWait);
+      return m_condition.Wait(&m_receiveMutex, m_iTransmitWait);
     return true;
   }
 
index 60133c71ca21ca84966b69bff4b633a47992ca7d..f6f397d46964254c56067df66a4857fa27663d97 100644 (file)
@@ -128,6 +128,7 @@ namespace CEC
     int32_t        m_iTransmitTimeout;
     int32_t        m_iTransmitWait;
     int8_t         m_iTransmitRetries;
+    CMutex         m_receiveMutex;
     CCondition     m_condition;
   };
 };