Hi,
I wanted to call Test1() Method Within WaitAndCallFunc() Function.
Code:
typedef void (*func)();
void StartTimer(void* pFuncAddr);
void WaitAndCallFunc(void* pPtr);
void WaitAndCallFunc(void* pPtr)
{
int i = 0;
int nWaitTime = 3;
while(1)
{
Sleep(1000);
// I want pPtr to call Test1 Function;
if(i == nWaitTime)
break;
}
_endthread();
}
void StartTimer(void* pFuncAddr)
{
_beginthread(WaitAndCallFunc, 0, pFuncAddr);
}
void Test1();
int main(int argc, char* argv[])
{
StartTimer(Test1);
Sleep(5000);
return 0;
}
void Test1()
{
cout << "Testing Thread\n";
}