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