Hey guys/girls ! I'm programming an application for which I have built classes ThreadedWorker and ThreadedWorkerManager. The ThreadedWorkerManager class needs to have a pointer to the callback function that will be used by the CreateThread() function. To lighten up a little bit the code, I have typedef'ed the function pointer and named it THREAD_PROC. The constructor of my ThreadedWorkerManager class takes a THREAD_PROC as only argument and later uses it. However, when I instantiate it, I get the following error:
I don't quite get why it complains, here's part of the code for ThreadedWorkerManager:Code:'ThreadedWorkerManager<T>::ThreadedWorkerManager(THREAD_FUNC)' : cannot convert parameter 1 from 'DWORD (void *)' to 'THREAD_FUNC' with [ T=WorkData * ]And this, is where the error occurs:Code:typedef DWORD (*THREAD_FUNC)(void*); template <typename T> class ThreadedWorkerManager; template <typename T> class ThreadedWorker; template <typename T> class ThreadedWorkerManager { public: ThreadedWorkerManager(THREAD_FUNC ptr = 0) : WorkerProc(ptr) { // ... } // ... private: THREAD_FUNC WorkerProc; //... };Do you guys have any idea of what could cause this error ? My friend and I are stumped and can't get how this is wrong.Code:DWORD WINAPI ThreadProc(void* data) { // ... } SettingsManager::SettingsManager() { // Bang ! I'm dead ! TWMgr = new ThreadedWorkerManager<WorkData*>(ThreadProc); // ... }
Thanks.
PS: I'm using MSVC++ 7.1



LinkBack URL
About LinkBacks


