shithub: openh264

Download patch

ref: 17e610da9fe9a1bf6b7d8a46db4c38b836701f6d
parent: c47d23594257b2db8ba018569b5b26663707058b
parent: 59779539e7e2522c379111dcd8aedbf750d3ddb6
author: huili2 <[email protected]>
date: Thu Nov 5 08:46:51 EST 2015

Merge pull request #2209 from sijchen/fixslc

[UT] add autolock in ThreadPoolTest to avoid possible conflict

--- a/test/common/WelsThreadPoolTest.h
+++ b/test/common/WelsThreadPoolTest.h
@@ -1,6 +1,7 @@
 #ifndef _WELS_THREAD_POOL_TEST_H_
 #define _WELS_THREAD_POOL_TEST_H_
 
+#include "WelsLock.h"
 #include "WelsThreadPool.h"
 
 using namespace WelsCommon;
@@ -14,6 +15,7 @@
   ~CThreadPoolTest() {}
 
   virtual int32_t OnTaskExecuted (IWelsTask* pTask) {
+    WelsCommon::CWelsAutoLock cAutoLock (m_cTaskCountLock);
     m_iTaskCount ++;
     //printf("Task execute over count is %d\n", m_iTaskCount);
     return cmResultSuccess;
@@ -20,6 +22,7 @@
   }
 
   virtual int32_t OnTaskCancelled (IWelsTask* pTask) {
+    WelsCommon::CWelsAutoLock cAutoLock (m_cTaskCountLock);
     m_iTaskCount ++;
     //printf("Task execute cancelled count is %d\n", m_iTaskCount);
     return cmResultSuccess;
@@ -31,6 +34,7 @@
 
  private:
   int32_t  m_iTaskCount;
+  WelsCommon::CWelsLock  m_cTaskCountLock;
 };