tmpInt=(INTEGER*)malloc(sizeof(INTEGER));
tmpInt->data=i;
CreateThread(NULL,0,threadWork,tmpInt,0,&targetThreadID);
Sleep(100);//Let newly created thread run
}
//Cycle while children work...
while(runFlag)
{
GetSystemTime(&now);
if((now.wMinute>=stopTimeMinute)&&(now.wSecond>=stopTimeSecond))
runFlag=FALSE;
Sleep(1000);
}
Sleep(5000);
printf("Program ends successfully\n");
}