OK, after my last thread on this subject failed miserably, I am trying again.
How do I go about creating and unlocking a set of 5 System V semaphores? Once this is done, how do I wait for them, and signal when I'm finished using it?
I'm trying to fork 5 children and execute their functions in a user-specified order. There are 5 children, so there should be a set of 5 semaphores. The user enters the order of execution (integer between 1 and 5, inclusive) using the keyboard. I fork the 5 children all at once, but I need to synchronize their execution with semaphores. How do I do this?
Also, please post code examples, not links to other pages. I have tried many other pages but they confuse me more than they help.
Thanks in advance.