ref: 59779539e7e2522c379111dcd8aedbf750d3ddb6
parent: f13f502203140574eb0e5c7bf15c0571ce7a57be
author: sijchen <sijchen@cisco.com>
date: Wed Nov 4 05:29:08 EST 2015
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;
};