platform: fixed initial value of m_thread in CThread
[deb_libcec.git] / src / lib / platform / threads / threads.h
index 0cc07eee883f6646e98bd65b6cfb601f5d8c1c96..36477708d4750e6c2e035ca739d067f06cdff26a 100644 (file)
@@ -41,14 +41,15 @@ namespace PLATFORM
     CThread(void) :
         m_bStop(false),
         m_bRunning(false),
-        m_bStopped(false) {}
+        m_bStopped(false),
+        m_thread(INVALID_THREAD_VALUE) {}
 
     virtual ~CThread(void)
     {
       StopThread(0);
-      void *retVal;
-      ThreadsWait(m_thread, &retVal);
-      (void *)retVal; //"unreferenced local variable" warning
+      void *retVal = NULL;
+      if (m_thread != INVALID_THREAD_VALUE)
+        ThreadsWait(m_thread, &retVal);
     }
 
     static void *ThreadHandler(CThread *thread)
@@ -143,13 +144,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;
   };
 };