计算机|Comp3770 A4

Each “car”s thread uses the SAME threadproc
Do NOT put synchronization code inside the threadproc – your threadproc should call a function that determines the winner based on where that car is and the finish line value.
Your code MUST normally result in a “race condition” ie. more than one car usually “wins”. Synchronization should remove the race condition. Use a boolean flag to turn on or off the synchronization. Put the synchronization code in the same function that causes the race condition (i.e. don’t create two versions of the same function). You will need to use Sleep() to force a race condition. I also use a really large empty for loop to add more “work” that each thread performs during each iteration to move the “car”
You need to use synchronization to control the processes (starting main program via Part2 or 3, ending Part2 or 3 via closing main program).
When Part1 closes it signals Part2 and Part3 to exit. In the example provided it requires the button on Part2 and Part3 to be pressed for it to hear the closing signal. However full FULL marks, yours should close the two programs even if the program Part2 or Part3 never had it’s button pressed