Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am currently working on a project to design Airport with OOP. I am using c++. I have a main Airport object in my program which has RequestLanding() function which assigns the runway number on which plane can land. This function returns one of the two enums- Hold or Proceed to indicate whether plane should land or not.

From the outside there are many airplane objects which makes the landing request. I am using for loop for the total number of airplane objects. I am using OpenMp for parallel loop. I wanted to make a thread of openmp sleep for 3 seconds when the RequestLanding() function returns the state Hold and then try again.

Is there a way to do this ? Can someone provide a simple example. Thanks in advance.

What I have tried:

i have not tried anything. could not find the information
Posted
Updated 16-Oct-17 6:49am

1 solution

I would solve this problem NOT with some waiting function, but a semaphore solution. Semaphore are resources which allowing some designated access and so fitting best for your probelm.

For learning on semaphores is a short explanation from Microsoft and also some deeper insights.

This link may help you in finding the final solution on Stack overflow.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900