From: Rafael Garcia-Suarez Date: Mon, 2 May 2005 17:10:19 +0000 (+0000) Subject: For perls where pids and ppids are cached, when the ppid of X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0e0556fc348ff5f8beae704376481cf3219b0abd;p=p5sagit%2Fp5-mst-13.2.git For perls where pids and ppids are cached, when the ppid of the perl process becomes 1, refresh the ppid cache (this may indicate that the parent process has died.) p4raw-id: //depot/perl@24367 --- diff --git a/pp_sys.c b/pp_sys.c index c127b64..ec094a0 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4377,6 +4377,12 @@ PP(pp_getppid) #ifdef HAS_GETPPID dSP; dTARGET; # ifdef THREADS_HAVE_PIDS + { + IV cur_ppid = getppid(); + if (cur_ppid == 1) + /* maybe the parent process has died. Refresh ppid cache */ + PL_ppid = cur_ppid; + } XPUSHi( PL_ppid ); # else XPUSHi( getppid() );