in reply to kill thread or fork processes

I would have a parent start two (or more) children. As soon as the first one terminates, it would send a suitable signal to the other one(s).

Update: in the above the emphasized "it" should refer to "the parent", although as jdhedden pointed out it seems to refer to "the first one". Apologies.

Replies are listed 'Best First'.
Re^2: kill thread or fork processes
by jdhedden (Deacon) on May 16, 2006 at 13:43 UTC
    It would be a bit difficult for two childred to signal each other as they wouldn't know the other's PID. Better to have child and parent handle the two tasks: The parent gets the child's PID from the fork() call, and the child can get the parent's PID using ppid().

    Remember: There's always one more bug.

      That's what I meant. I guess... ;-)