home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / perl / 7019 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.1 KB  |  36 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!panther!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
  3. From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: How to check if a given process ID is still around?
  5. Message-ID: <mcook.722017897@fendahl.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: fendahl.dev.cdx.mot.com
  8. Organization: Motorola Codex, Canton, Massachusetts
  9. References: <1992Nov17.000624.21281@schbbs.mot.com>
  10. Date: Tue, 17 Nov 1992 16:31:37 GMT
  11. Lines: 23
  12.  
  13. mmuegel@next3.corp.mot.com (Michael S. Muegel) writes:
  14.  
  15. >Is there way (not using ps(1)) to see if a given PID is active? I am writing 
  16. >a scheduler that spawns children to performan various tasks and I want the 
  17. >scheduler to know if the child has quit. This way I will never run two of 
  18. >the same child "modules" simulataneously. I know I could use IPC but the 
  19. >PID trick would be an easy kludge.
  20.  
  21.   if (!kill(0, $pid) && $! =~ /No such process/)
  22.   {
  23.     print "$pid is dead.\n";
  24.   }
  25.   else
  26.   {
  27.     print "$pid is still alive.\n";
  28.   }
  29.  
  30. You might also consider using SIGCHILD.
  31.  
  32. >Thanks!
  33. >-Mike
  34.  
  35. You're welcome, Mike.
  36.