I have a class that as part of its initialize function needs to start a thread that is specific to the instantiation of the class.
so for example
Code:
CClass* pClass;
pClass = new CClass();
pClass->Initialize();
and the Class function -
Code:
class CClass {
private:
HANDLE hThread;
DWORD ThreadId;
public:
void Initialize();
DWORD WINAPI Thread(LPVOID);
};
CClass::Initialize(){
hThread = CreateThread(NULL , 0 , &Thread , NULL , 0 , &ThreadId);
return;
}
CClass::Thread(LPVOID lParam){
// thread code goes here
return 0;
}
My question is will the call to pClass->Initialize() properly start a thread based on the class specific function?