cec: created a separate reader thread and fixed the 'lock timeout' bug
[deb_libcec.git] / src / lib / util / threads.cpp
index 3e40c2ba0370288cb668662514a91f52b3f10405..0e188c3fb71ff206e689bda4846fb273d8fef219 100644 (file)
@@ -82,10 +82,21 @@ CLockObject::CLockObject(CMutex *mutex, int64_t iTimeout /* = -1 */) :
 }
 
 CLockObject::~CLockObject(void)
+{
+  Leave();
+  m_mutex = NULL;
+}
+
+void CLockObject::Leave(void)
 {
   m_mutex->Unlock();
   m_bLocked = false;
-  m_mutex = NULL;
+}
+
+void CLockObject::Lock(void)
+{
+  m_mutex->Lock();
+  m_bLocked = true;
 }
 
 CCondition::CCondition(void)