home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7412 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.6 KB  |  47 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!caen!malgudi.oar.net!chemabs!jon
  3. From: jon@cas.org (Jon Vander Hill)
  4. Subject: Re: timing problem with $SIG{'CHLD'}
  5. In-Reply-To: ggr@nareen.acci.COM.AU's message of Sun, 13 Dec 1992 23:56:32 GMT
  6. Message-ID: <JON.92Dec14133250@cas.org>
  7. Sender: usenet@cas.org
  8. Organization: Chemical Abstracts Service, Columbus, Ohio
  9. References: <1992Dec9.102933.27264@hemlock.cray.com> <9=h2hs#@rpi.edu>
  10.     <9234910.11586@mulga.cs.mu.OZ.AU>
  11. Date: Mon, 14 Dec 1992 18:32:50 GMT
  12. Lines: 33
  13.  
  14. >>>>> On Sun, 13 Dec 1992 23:56:32 GMT, ggr@nareen.acci.COM.AU (Greg Rose) said:
  15.  
  16. > In article <9=h2hs#@rpi.edu> nobled@rebecca.its.rpi.edu (David Noble) writes:
  17. >>    until ($addr = accept(NS,S))
  18. >>    { die $! unless $! eq 'Interrupted system call'; }
  19. >>
  20. >>Of course, this breaks if the text of the error message varies for
  21. >>different platforms. In that case, you would have to check for any
  22. >>variants on the interrupted system call message. Anybody know offhand
  23. >>whether the text of $! is defined by perl or the operating system?
  24.  
  25. > My understanding is that the text of the error message comes from
  26. > somthing that (eg. IBM) vendors often change, but the *NUMBER*
  27. > associated with the error is defined by POSIX. So I always use
  28.  
  29. > sub EINTR { 4; }
  30.  
  31. > until ($addr = accept(NS,S)) {
  32. >     die $! unless $! == &EINTR;
  33. > }
  34.  
  35. Even more portable would be:
  36.  
  37. require "errno.ph";  # assuming this has been added to your perl lib
  38.  
  39. $EINTR = &EINTR;     # this will fail if &EINTR is not defined
  40.  
  41. until ($addr = accept(NS,S)) {
  42.   die $! unless $! == $EINTR;
  43. }
  44.  
  45. Jon Vander Hill
  46. jon@cas.org
  47.