I am trying to thread a member function for my template class. This thread is meant to update everything within the class at all times, and keep things "up to date". I am having problems with...
1) understanding exactly what the errors mean. I have an idea, but its not completely clear.
2) Actually getting it to compile.
I have tried going about this a few ways and searched this forum but nothing seems to work. I also tried codeproject.com for a solution, and that also did not work.
I've noticed work arounds that use non-member functions to be a thread, that calls functions within the class instead of having a class member be the thread. I would like to avoid this, but is this the only solution?
The error
The code, anything not defined here is defined as a private/protected member of the class.Code:error C3867: 'octalTree<ObjectType>::updateOctalTreeThread': function call missing argument list; use '&octalTree<ObjectType>::updateOctalTreeThread' to create a pointer to member
Code:// update thread, I have tried type casting the thread pointer as // LPTHREAD_START_ROUTINE, which gives more errors since it can't do it template<class ObjectType> DWORD octalTree<ObjectType>::updateOctalTreeThread(void* arg) { destroy(); for(int i = 0; i < allObjects.size(); i++) { add(allObjects[i], allPositions[i]); } } // the constructor trying to create the thread template<class ObjectType> octalTree<ObjectType>::octalTree(void) { root = new octalNode; for(int i = 0; i < 8; i++) { root->child[i] = NULL; } objectsPerNode = 1; hUpdateThread = CreateThread(NULL, 0, updateOctalTreeThread, (void*)this, 0, &threadID); }



LinkBack URL
About LinkBacks




.