home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / wizards / 3791 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  3.3 KB

  1. Xref: sparky comp.unix.wizards:3791 comp.unix.questions:10724 comp.windows.x:16173
  2. Newsgroups: comp.unix.wizards,comp.unix.questions,comp.windows.x
  3. Path: sparky!uunet!mcsun!ieunet!tcdcs!unix1.tcd.ie!acourtny
  4. From: acourtny@unix1.tcd.ie (Antony A. Courtney)
  5. Subject: Re: reliable signals under BSD / SVR4
  6. Message-ID: <acourtny.715596957@unix1.tcd.ie>
  7. Keywords: signals, reliable, software interrupts
  8. Sender: usenet@cs.tcd.ie (NN required at ashe.cs.tcd.ie)
  9. Nntp-Posting-Host: unix1.tcd.ie
  10. Organization: Trinity College, Dublin
  11. References: <acourtny.715263267@unix1.tcd.ie> <Btwqvs.LAI@zeus.dialix.oz.au> <acourtny.715556934@unix1.tcd.ie> <1992Sep3.231707.17858@noao.edu>
  12. Date: Fri, 4 Sep 1992 08:55:57 GMT
  13. Lines: 49
  14.  
  15. In <1992Sep3.231707.17858@noao.edu> rstevens@noao.edu (W. Richard Stevens) writes:
  16.  
  17. >>Come to think of it, doesn't it make it somewhat "tricky" to use
  18. >> async. I/O at all?
  19.  
  20. >I've yet to find a real application that actually uses BSD's SIGIO.
  21. >Has anyone seen one?
  22.  
  23. Sure.  Back when I was at LBL, we had an animation server which I ported to X.
  24. When you hit the "play" button on the interface, it would just render frames
  25. as fast as it could.  I didn't want the overhead of a "check for any activity
  26. on my UI" inside this loop, so I marked the socket connected to the X server
  27. for asynchronous I/O.  That way it would actually stop when you hit the "stop"
  28. button on the UI.  This is also applicable to any system which passes control
  29. to some subroutine library for what could be "a long time" (e.g. doing a real
  30. long image transformation of some sort).
  31.  
  32. The impression one gets from reading the docs on BSD's SIGIO is that it can
  33. be used to write programs using interrupt-driven i/o.  IMHO, if no "real"
  34. programs use SIGIO it shouldn't be provided.  But if it is provided, it should
  35. work as advertised.
  36.  
  37. (begin long aside)
  38. That said, it can be argued that any library which forces the programmer to 
  39. relinquish the flow of control to the library is badly designed.  Obviously 
  40. there can be only one main dispatch loop in a single-threaded program, so it is 
  41. at best quite difficult to interwork two libraries which want to provide the 
  42. main dispatch loop for the programmmer.  (e.g.  using an X toolkit in 
  43. conjunction with RPC) Further, such centralized dispatch loops use an 
  44. "event-callback" mechanism which clouds the natural control flow that 
  45. characterises the program.  This means that every "callback" function has to 
  46. check any data structure it operates on for consistency and validity.  For 
  47. instance, if I have a callback for a "zoom" button in a program that manipulates
  48. images, my callback function has to check that the image data structure is 
  49. consistent, since it doesn't have any way of knowing whether or not the "load"
  50. button has been pressed to load an image.  In a more conventional program, the 
  51. flow of control is governed by the program structure, and the abstract flow
  52. graph it defines would never let a "zoom" function be called before a "load"
  53. function. 
  54. (end long aside)
  55.  
  56. >    Rich Stevens  (rstevens@noao.edu)
  57.  
  58.     -antony
  59. --
  60. ********************************************************************************
  61. * Antony A. Courtney                              Email: acourtny@unix1.tcd.ie *
  62. * Computer Science Department                            antony@george.lbl.gov *
  63. * Trinity College, Dublin, Ireland                Phone: 01+353+1-607389       *
  64.