home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / wizards / 3891 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  1.9 KB

  1. Xref: sparky comp.unix.wizards:3891 comp.unix.questions:10964
  2. Path: sparky!uunet!mcsun!Germany.EU.net!tools!ws
  3. From: ws@tools.de (Wolfgang Solfrank)
  4. Newsgroups: comp.unix.wizards,comp.unix.questions
  5. Subject: Re: reliable signals under BSD / SVR4
  6. Date: 11 Sep 92 18:33:01
  7. Organization: TooLs GmbH, Bonn, Germany
  8. Lines: 28
  9. Message-ID: <WS.92Sep11183301@kurt.tools.de>
  10. References: <acourtny.715263267@unix1.tcd.ie> <Btwqvs.LAI@zeus.dialix.oz.au>
  11.     <acourtny.715556934@unix1.tcd.ie>
  12. NNTP-Posting-Host: kurt.tools.de
  13. In-reply-to: acourtny@unix1.tcd.ie's message of 3 Sep 92 21:48:54 GMT
  14.  
  15. In article <acourtny.715556934@unix1.tcd.ie> acourtny@unix1.tcd.ie (Antony A. Courtney) writes:
  16.  
  17. >   Since signals are
  18. >   meant to be analogous to interrupts, wouldn't it be useful to guarantee that
  19. >   all signals sent are processed?  I would think this would be particularly
  20. >   useful for programs that request async. I/O on a descriptor.
  21.  
  22. But interrupts aren't counted either (at least on no machine I've come across).
  23.  
  24. >   Come to think of it, doesn't it make it somewhat "tricky" to use async. I/O at
  25. >   all?
  26. >
  27. (pseudo source deleted)
  28. >
  29. >   This code has an obvious race condition, since the check for EWOULDBLOCK and
  30. >   the return from the signal handler is non-atomic.  If data arrives on the
  31. >   descriptor between the time of checking for EWOULDBLOCK and returning from
  32. >   the signal handler, the SIGIO will not be delivered since there is already
  33. >   one pending.  This will leave unprocessed data pending in the buffer for the
  34. >   descriptor.
  35.  
  36. No, there is no race condition envolved. If data arrives on the descriptor
  37. after the handler was entered, the signal is (re-)scheduled for delivery at
  38. the next possibility. If the read sets errno to EWOULDBLOCK, the handler
  39. returns and is immediately recalled. You see, no problem. Just the same
  40. as with hardware interrupts.
  41. --
  42. ws@tools.de     (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
  43.