template < typename threadFuncParamT >
class ThreadWrapper
{
public:
static int ThreadRoutineFunction(void* pParam);
int ExecuteThread();
ThreadWrapper(ThreadPool<threadFuncParamT> *pPool);
};
template<typename threadFuncParamT>
int ThreadWrapper<threadFuncParamT>::ThreadRoutineFunction(void* pParam)
{
ThreadWrapper<threadFuncParamT> *pWrapper = reinterpret_cast<ThreadWrapper<threadFuncParamT>*>(pParam);
if(pWrapper != NULL)
{
return pWrapper-ExecuteThread(); // Error here.
}
return 0;
}
template < typename threadFuncParamT >
ThreadWrapper<threadFuncParamT>::ThreadWrapper(ThreadPool<threadFuncParamT> *pPool)
{
ThreadWrapper<threadFuncParamT>::m_pThreadPool = pPool;
m_tbbThread = new tbb::tbb_thread(&(ThreadWrapper<threadFuncParamT>::ThreadRoutineFunction), this);
if (m_tbbThread->native_handle() == 0)
{
delete m_tbbThread;
m_tbbThread = NULL;
// TODO: throw execption here or raise assert.
}
}
我得到如下錯誤 錯誤1錯誤C2352:「ThreadWrapper :: ExecuteThread」:非靜態成員函數
我的非法調用我正在編譯VS2010。
任何人可以幫助我在這裏如何清除錯誤。
謝謝!
你有一個錯字,你的意思是'pWrapper-> ExecuteThread()',正確嗎? –
這是一個明顯的錯誤,我不得不問,你甚至檢查過編譯器錯誤試圖告訴你什麼嗎? –
這太明顯了嗎?你有任何問題要了解這個錯誤? – neuront