home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7373 < prev    next >
Encoding:
Internet Message Format  |  1992-12-11  |  1.4 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!yale.edu!jvnc.net!newsserver.technet.sg!nuscc!ccechk
  2. From: ccechk@nuscc.nus.sg (Heng Kek)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: timing problem with $SIG{'CHLD'}
  5. Message-ID: <1992Dec11.073301.29314@nuscc.nus.sg>
  6. Date: 11 Dec 92 07:33:01 GMT
  7. References: <1992Dec7.112748.24164@hemlock.cray.com>
  8. Organization: National University of Singapore
  9. Lines: 29
  10. X-Newsreader: Tin 1.1 PL4
  11.  
  12. mlo@cray.com (Mick Oyer) writes:
  13. : I'm trying to set up a daemon, written in perl, that will listen
  14. : for messages coming across the network.  I used the client/server
  15. : model in the Camel book as a starting point, but am running into
  16. : a sticky situation.
  17. [..deleted..]
  18. : I'm setting $SIG{'CHLD'} to reap the zombies.
  19. : The problem:
  20. : my code is blocking on the 'accept' call.  When the child
  21. : exits, the CHLD signal causes reaper to get called, interfering
  22. : with the accept:
  23. :     Interrupted system call at ./modinfod line 45.
  24. :     (line 45):    ($addr = accept(NS,S)) || die $!;
  25.  
  26. I had EXACTLY the same problem.  My work-around was to re-invoke
  27. 'accept()' when it dies as per the problem above.  I use:
  28.  
  29.   ($addr = accept(KK,S)) || ($addr = accept(KK,S)) || 
  30.                              die "accept:$!\n";
  31.             # ..to avoid accept() dying and killing the prog.
  32.  
  33. Any criticism on this method is most welcome as I'd like to learn
  34. too.
  35.  
  36. Sincerely
  37. Heng Kek
  38.