From: Lars Op den Kamp Date: Tue, 6 Dec 2011 15:40:14 +0000 (+0100) Subject: cec: don't unlock the transmit mutex in CCECProcessor while waiting for an answer X-Git-Tag: upstream/2.2.0~1^2~44^2~32 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=6359ffd1d200e28f5cf7ae574960e535e28b14d7 cec: don't unlock the transmit mutex in CCECProcessor while waiting for an answer --- diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 9742739..9f8dc9d 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -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; } diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index 60133c7..f6f397d 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -128,6 +128,7 @@ namespace CEC int32_t m_iTransmitTimeout; int32_t m_iTransmitWait; int8_t m_iTransmitRetries; + CMutex m_receiveMutex; CCondition m_condition; }; };