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