Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: I got zombiesby BlaisePascal (Monk) |
on Aug 08, 2000 at 03:48 UTC ( [id://26700]=note: print w/replies, xml ) | Need Help?? |
It doesn't sound like zombies to me.. Zombies die before
their parents, not the otherway around.
If I understand you, you are doing something like this: (Note: I can't find any perl documentation on setsid, where am I not looking?) According to Stevens (Advanced Programming in the UNIX Environment) that is basically the standard recipe for creating a detached process -- one in it's own session and process group. And since the child's real parent is dead, it was inherited by init (process 1). So if that is what you are doing, then you are doing exactly the wrong thing to do if you want the child to die when the parent does. If you want the background process to terminate when the foreground process terminates cleanly (i.e., not from "kill -9"), you could use a flag set by parent when shutting that is shared between processes, or or pass the child's PID to the parent (through shared memory) and send a signal from the exiting parent. If you wanted a SIGINT or SIGKILL to go to both processes, you could use setpgrp() to place the background process in the same process group as the parent (but you can do the same thing by not using setsid). Why are you using setsid() in the first place?
In Section
Seekers of Perl Wisdom
|
|