Detect Close of a background process
Right now I have a program that executes another program and lets it run in the background. I want to know when the background process quits. I also want to know which background process quits, I can have multiple background processes running at the same time. All my background processes are stored in an array.
I am trying to use the SIGCHLD, but I can't find a way to see which process actually sent the signal. I just get a default signal for whatever process closes.
Any ideas on how I can use SIGCHLD or anything else?