| Dosteven (2) | |
|
I'm trying to write a program that will fork a number of children processes that will run concurrently and exit after some randomized amount of time. My problem is that I need the parent to spit out a message each time a child exits as follows: "Daughter PID EXITED after (t) seconds." with actual values for PID and (t). How would I make the parent detect when an exit has occurred and then display the message? | |
|
Last edited on
|
|
| kbw (5517) | |
|
You may want to take a look at waitpid with the WNOHANG option: http://pubs.opengroup.org/onlinepubs/007908799/xsh/wait.html | |
|
|
|
| Dosteven (2) | |
| Awesome, thanks! | |
|
|
|