Hi,
Is there any way to create a Thread in a Class, which start-function is also in the class, and not a normal function?
Declare the function you want to call as a static member. Like this:
In the implementation you could do this:
Call it like this:
Edited by - Imois on July 20, 2001 3:26:16 PM
static void CClass::EntryProc(void* pPointer)
In the implementation you could do this:
void CClass::EntryProc(void* pPointer){ CClass* pCaller = (CClass*)pPointer; assert(pPointer) // Must have a pointer to the caller pPointer->DoSomething();}
Call it like this:
void CClass::NewThread(){ _beginthread(EntryProc,0,(void*)this);}
Edited by - Imois on July 20, 2001 3:26:16 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement