You should then create 8 new threads, each one representing a (uniquely numbered) plane; the main function should wait for all of the threads to complete and then exit. Each thread represents an airplane, and should repeatedly follow these steps: 1. board. Waits for 12 passengers to get on the plane. Between each available passenger boarding a random delay of between 0 and 2 seconds should be enforced. This can be accomplished by calling sleep(rand()%3) after each passenger boards. 2. The associated plane should then be shown taxi-ing to the runway. See the provided AirportAnimator class ! 3. The associate plane should then use the runway to take off, animating such (see the provided AirportAnimator class!) Of course, the plane should wait for exclusive access to the runway. 4. The plane should then go on tour. This basically just sleeps for between 15 and 45 seconds, and can be accomplished by calling sleep(15+rand()%31).
Comments
Leave a comment