Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: getppid() returns cached value

by Molt (Chaplain)
on May 26, 2005 at 15:47 UTC ( #460737=note: print w/ replies, xml ) Need Help??


in reply to getppid() returns cached value

I've been working on this same problem myself lately, and think I've found a work-around that looks like it works although I've not yet had time to try it.

The kill function can be used to check if a given process ID is available to receive signals (With some limitations on OS, see the perlport docs for details), so the way I'm planning on checking for a parent process' death is something like:

if (getppid==1 or !kill (0, getppid)) { # Parent is dead, long live the child! } else { # Parent still alive. }

As I've said I've not had time to actually try this myself yet, but it's looking to be along the right lines and replace the Proc::ProcessTable hack I'm currently using for the job. Let me know if it does work for you.


Comment on Re: getppid() returns cached value
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://460737]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (16)
As of 2015-07-06 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (75 votes), past polls