cec: dropped second mutex in CAdapterCommunication. it's all called from 1 thread now
authorLars Op den Kamp <lars@opdenkamp.eu>
Sat, 29 Oct 2011 21:07:37 +0000 (23:07 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sat, 29 Oct 2011 21:07:37 +0000 (23:07 +0200)
src/lib/AdapterCommunication.cpp
src/lib/AdapterCommunication.h

index 0439100bf60e4938b026a9be22392bb153d518b5..003d9876b9b52cc9a621d697694bb40d4462e1e2 100644 (file)
@@ -60,7 +60,6 @@ CAdapterCommunication::~CAdapterCommunication(void)
 
 bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38400 */, uint32_t iTimeoutMs /* = 10000 */)
 {
-  CLockObject lock(&m_commMutex);
   if (!m_port)
   {
     m_controller->AddLog(CEC_LOG_ERROR, "port is NULL");
@@ -101,7 +100,6 @@ bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38
 
 void CAdapterCommunication::Close(void)
 {
-  CLockObject lock(&m_commMutex);
   StopThread();
 
   m_rcvCondition.Broadcast();
@@ -113,7 +111,7 @@ void *CAdapterCommunication::Process(void)
 
   while (!IsStopped())
   {
-    ReadFromDevice(100);
+    ReadFromDevice(500);
     WriteNextCommand();
     Sleep(5);
   }
@@ -123,7 +121,6 @@ void *CAdapterCommunication::Process(void)
 
 bool CAdapterCommunication::ReadFromDevice(uint32_t iTimeout)
 {
-  CLockObject lock(&m_commMutex);
   int32_t iBytesRead;
   uint8_t buff[1024];
   if (!m_port)
@@ -154,7 +151,6 @@ void CAdapterCommunication::AddData(uint8_t *data, uint8_t iLen)
 
 void CAdapterCommunication::WriteNextCommand(void)
 {
-  CLockObject lock(&m_commMutex);
   CCECAdapterMessage msg;
   if (m_outBuffer.Pop(msg))
   {
index c9a8e8c1155de1132d85c324c702182b5123e538..0d4ac9b33cd88d5be62e46e1c14de02cfdaf5fbc 100644 (file)
@@ -148,7 +148,6 @@ namespace CEC
     CecBuffer<uint8_t>            m_inBuffer;
     CecBuffer<CCECAdapterMessage> m_outBuffer;
     CMutex                        m_bufferMutex;
-    CMutex                        m_commMutex;
     CCondition                    m_rcvCondition;
   };
 };