Imagine I have a process that starts several child processes. The parent needs to know when a child exits.
I can use waitpid, but then if/when the paren
waitpid
If you're going to use signals anyways (as per Steve's suggestion), you can just send the signal manually when you want to exit. This will cause waitpid to return EINTR and the thread can then exit. No need for a periodic alarm/restart.