cec: close the connection when a comm error was detected, and notify the client via...
[deb_libcec.git] / src / lib / platform / threads / threads.h
index 1d14f8cea32560befc14f24267df7e07a55bfbb5..31c2daffa2e39c4ff5cf08ec768b0f235efbbe9a 100644 (file)
@@ -48,6 +48,7 @@ namespace PLATFORM
       StopThread(0);
       void *retVal;
       ThreadsWait(m_thread, &retVal);
+      (void *)retVal; //"unreferenced local variable" warning
     }
 
     static void *ThreadHandler(CThread *thread)
@@ -90,18 +91,18 @@ namespace PLATFORM
 
     virtual bool CreateThread(bool bWait = true)
     {
-        bool bReturn(false);
-        CLockObject lock(m_threadMutex);
-        if (!IsRunning())
+      bool bReturn(false);
+      CLockObject lock(m_threadMutex);
+      if (!IsRunning())
+      {
+        m_bStop = false;
+        if (ThreadsCreate(m_thread, CThread::ThreadHandler, ((void*)static_cast<CThread *>(this))))
         {
-          m_bStop = false;
-          if (ThreadsCreate(m_thread, CThread::ThreadHandler, ((void*)static_cast<CThread *>(this))))
-          {
-            if (bWait)
-              m_threadCondition.Wait(m_threadMutex, m_bRunning);
-            bReturn = true;
-          }
+          if (bWait)
+            m_threadCondition.Wait(m_threadMutex, m_bRunning);
+          bReturn = true;
         }
+      }
       return bReturn;
     }
 
@@ -142,13 +143,13 @@ namespace PLATFORM
 
   protected:
     void SetRunning(bool bSetTo);
+    CMutex           m_threadMutex;
 
   private:
     bool             m_bStop;
     bool             m_bRunning;
     bool             m_bStopped;
     CCondition<bool> m_threadCondition;
-    CMutex           m_threadMutex;
     thread_t         m_thread;
   };
 };