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

  1. Xref: sparky comp.unix.wizards:3805 comp.unix.questions:10750 comp.windows.x:16202
  2. Path: sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!cs.utexas.edu!hellgate.utah.edu!fcom.cc.utah.edu!park.uvcc.edu!ns.novell.com!gateway.novell.com!thisbe!terry
  3. From: terry@thisbe.npd.Novell.COM (Terry Lambert)
  4. Newsgroups: comp.unix.wizards,comp.unix.questions,comp.windows.x
  5. Subject: Re: reliable signals under BSD / SVR4
  6. Keywords: signals, reliable, software interrupts
  7. Message-ID: <1992Sep4.213203.23649@gateway.novell.com>
  8. Date: 4 Sep 92 21:32:03 GMT
  9. References: <acourtny.715263267@unix1.tcd.ie> <Btwqvs.LAI@zeus.dialix.oz.au> <acourtny.715556934@unix1.tcd.ie> <1992Sep4.004436.24755@gateway.novell.com> <acourtny.715602566@unix1.tcd.ie>
  10. Sender: terry@thisbe (Terry Lambert)
  11. Organization: Novell NPD -- Sandy, UT
  12. Lines: 69
  13. Nntp-Posting-Host: thisbe.eng.sandy.novell.com
  14.  
  15. In article <acourtny.715602566@unix1.tcd.ie>, acourtny@unix1.tcd.ie (Antony A. Courtney) writes:
  16. |> In <1992Sep4.004436.24755@gateway.novell.com> terry@thisbe.Eng.Sandy.Novell.COM (Terry Lambert) writes:
  17. |> 
  18. |> >In article <acourtny.715556934@unix1.tcd.ie> acourtny@unix1.tcd.ie (Antony A. Courtney) writes:
  19. |> >>There are some "hacks" to get around this, if you're environment lets you
  20. |> >>write the centralized control loop for the program.  But usually SIGIO is
  21. |> >>useful in cases where that isn't possible, e.g. when using an X toolkit.
  22. |> >
  23. |> >    Wrong.  In XTMainAppLoop() in the X toolkit, there are hooks for
  24. |> >adding input sources to be "select()"ed on.
  25. |> > [...]
  26. |> 
  27. |>     I didn't assert that it was totally impossible, just that it was a
  28. |> "hack".  Adding extra input sources before passing control to XTMainAppLoop()
  29. |> is a bit like saying "take over the control flow and tell me when something
  30. |> happens that you understand (X events).  Oh, and also please tell me about
  31. |> anything else that happens on these descriptors, even though you have no idea
  32. |> what they are for and you don't know how to deal with them."  I humbly suggest
  33. |> that this is hardly what one would call "elegant".
  34.  
  35.     Well, a hack's basically what you are doing.  The other method, which
  36. *truly* is a hack, is to select on your descriptors AND the Xfd, and call an
  37. unrolled XtMainAppLoop() for the processing of X events only.  Certainly the
  38. registration of imput sources is more elegant than that.  And there's no
  39. requirement that the input sources can not be registered as part of a callback
  40. routine *after* entering XtMainAppLoop(), unless you are talking about command
  41. line parameters on which the main thread of execution is supposed to act.
  42.  
  43.     The problem is that your application is using a toolkit at all, given the
  44. non-event-driven nature of it, since a toolkit assumes that you will be doing
  45. event callback processing.  This is fine for word processors and calculators
  46. and such, but sucks out for anything with multiple input sources (like telnet or
  47. xterm or talk).  There is a problem when you try to mix thread of execution
  48. paradigms, like clasical procedural and event based programming styles.
  49.  
  50.     Perhaps what you really need is to start with XtMainAppLoop() as your
  51. main procedural function, or simply use the object drawing code directly, if
  52. what you are doing is antithetical to "toolkit" programming.
  53.  
  54. |> >    Read the fine manual.
  55. |> 
  56. |>     I have read the fine manual on select() for my Unix system.  Too bad X
  57. |> toolkits hide "all that underlying system control flow stuff" from me...
  58.  
  59.     Perhaps I was to flip here, in not siting the O'Reilly X Toolkit
  60. programmer's guide (Hi Tim!  I want a commision!), seeing as you appear to
  61. have gotten the impression I was referring to the UNIX manual page on select().
  62. I was referring to where you would find documentation on the input registration
  63. mechanisms I cited, not denigrating your desire to use select().
  64.  
  65.     Another alternative would be to download the X Toolkit from one of the
  66. many ftp sites (export.lcs.mit.edu, gatekeeper.dec.com, wuarchive.wustl.edu,
  67. etc.) and reimplement the main loop callback mechanism procedurally.  I did
  68. this for "TERM for X Windows" with only a little difficulty about 2 or 2 1/2
  69. years ago.
  70.  
  71.     I don't think anyone who has tried to do a complex job using an X
  72. interface toolkit would argue that they are suitable for complex jobs; however,
  73. I normally look at problems in light of "how can I *make* this work".  This is
  74. pretty much how you can *make* it work.  Good luck on your problem.
  75.  
  76.  
  77.                     Terry Lambert
  78.                     terry_lambert@gateway.novell.com
  79.                     terry@icarus.weber.edu
  80.  
  81. ---
  82. Disclaimer:  Any opinions in this posting are my own and not those of
  83. my present or previous employers.
  84.