cec: don't reset the "adapter message sent" event
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 15 Feb 2012 10:00:33 +0000 (11:00 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 15 Feb 2012 10:00:33 +0000 (11:00 +0100)
src/lib/adapter/USBCECAdapterMessage.h
src/lib/platform/threads/mutex.h

index d3f5d3e63f0108d58595d72a258c3161fce5d9dc..06e4088eb81a54db93db5f2ea05932b2a61a5df4 100644 (file)
@@ -38,7 +38,8 @@ namespace CEC
   class CCECAdapterMessage
   {
   public:
-    CCECAdapterMessage(void)
+    CCECAdapterMessage(void) :
+        event(false)
     {
       Clear();
     }
index 4a0c331a1fa6d64cbffa29e8466e25c29aca211a..5a9ae135ee9858548c937b2faf395224fa44d7bb 100644 (file)
@@ -280,10 +280,11 @@ namespace PLATFORM
   class CEvent
   {
   public:
-    CEvent(void) :
+    CEvent(bool bAutoReset = true) :
       m_bSignaled(false),
       m_bBroadcast(false),
-      m_iWaitingThreads(0) {}
+      m_iWaitingThreads(0),
+      m_bAutoReset(bAutoReset) {}
     virtual ~CEvent(void) {}
 
     void Broadcast(void)
@@ -336,7 +337,7 @@ namespace PLATFORM
     {
       CLockObject lock(m_mutex);
       bool bReturn(m_bSignaled);
-      if (bReturn && (--m_iWaitingThreads == 0 || !m_bBroadcast))
+      if (bReturn && (--m_iWaitingThreads == 0 || !m_bBroadcast) && m_bAutoReset)
         m_bSignaled = false;
       return bReturn;
     }
@@ -346,5 +347,6 @@ namespace PLATFORM
     CMutex                     m_mutex;
     volatile bool              m_bBroadcast;
     unsigned int               m_iWaitingThreads;
+    bool                       m_bAutoReset;
   };
 }