Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

CreateThread() function

stephen-smolley
412 Views
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
Reply