Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
18 Views

CreateThread() function

I have been wondering about this function. How much processing time is taken when this function is called?

Specifically:

How much faster is this at setting variable to 1:

int variable = 0;
int main()
{
variable = 1;
return 0;
}


Than this:

int variable = 0;
LRESULT WINAPI ThreadProc(LPVOID lpParameter)
{
variable = 1;
return 0;
}

int main()
{
DWORD dwThreadID;
CreateThread(0,0,ThreadProc,0,&dwThreadID);

while(variable==0) {Sleep(10);}

return 0;
}

Thanks,

-Steve
0 Kudos
0 Replies