Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[C] SIGINT + SIGTERM to parent and children

Name: Anonymous 2009-11-19 6:00

'sup guys?

I have a parent process that at some point forks into at least one child process.
I want to kill everything (parent+children) if the parent or any of its child processes get a SIGINT or SIGTERM.

How can I do this?

I know I have to use stuff from signal.h and probably a mutex(not sure on this?) to flag when it's time to die.

I would appreciate if you guys could help me.

Thank you.

Anon.

Name: Anonymous 2009-11-19 7:54

OP here.

Something like:

void rip () {
 killpg(0, SIGKILL);
}

int main (void)
{
  signal (SIGTERM, handler);
  signal (SIGINT, handler);


?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List