1. Modify the thread function to report the thread creation sequence (that is, “
ID: 3798621 • Letter: 1
Question
1. Modify the thread function to report the thread creation sequence (that is, “Hello Thread 0”, “Hello Thread 1”, “Hello Thread 2”, and so on).
Hint: Use the CreateThread() loop variable to give each thread a unique number.
2. Build and execute your program.
In what order do the threads execute?
Do the results look correct?
Why or why not?
If modify compiler option to /MP build with multiple processes, then how execution order changes?
3. The execution order to threads is unpredictable? T/F?
#include "stdafx h #include windows.h #includeExplanation / Answer
DWORD WINAPI helloFunc (LPVOID pArg)
{
Static int i=0;
printf ("Hello thread % d ", i);
returrn 0;
}
In sequential order threads will be executed.
False
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.