Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

CreateThread() function

stephen-smolley
Beginner
73 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