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!
For the latest information on Intel’s response to the Log4j/Log4Shell vulnerability, please see Intel-SA-00646

CreateThread() function

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