Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!bloom-beacon!THINK.COM!rlk From: rlk@THINK.COM (Robert L. Krawitz) Newsgroups: comp.windows.x Subject: getting CONTROL C to interrupt X application Message-ID: <8908311339.AA16086@regin.think.com> Date: 31 Aug 89 13:39:58 GMT References: <261@auto-trol.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 40 Date: 30 Aug 89 22:41:56 GMT From: mailrus!ncar!ico!auto-trol!marbru@ohio-state.arpa (Martin Brunecky) In article <2395@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: >> I'm not sure if this is what you wanted, > >If he genuinely wanted an asynchronous interrupt, it's probably not. >The problem is that a polling strategy requires you to poll >periodically. Such a strategy may be implementable in many >applications, and it may be implementable in his, though. YES, polling is the only answer in the X world. One way of doing it is to do your own XtMainLoop, i.e. call XtDispatchNextEvent explicitly. But before this, you can always look if there is anything in the queue, and if yes, you can look for a key event with control C in it. When you find one, do whatever is appropriate - kill yourself, discard the entire X queue etc. This, fortunately, is not true. Gnu Emacs under both X10 and X11 does use signals (SIGIO, to be precise). It needs to if the user is to be able to interrupt the running process. It's possible for emacs to get into an infinite loop, or otherwise run continuously for a long time, and it's essential that the user be able to deliver an interrupt. Emacs does have a dispatch loop of sorts, but the dispatch loop is logically based upon the user issuing a command and emacs coming back after processing it (with some exceptions -- subprocesses can be running that deliver output asynchronously). Emacs is an X client when running under X, but it is not tied to X in the same way that clients such as xterm are; to emacs, X is just another flavor of I/O device. Of course, emacs's solution isn't portable to all X client machines, much less all Unices (I don't believe that SysV implements SIGIO or the like, even now). On the other hand, it needs certain capabilities, even if X doesn't provide them. ames >>>>>>>>> | Robert Krawitz 245 First St. bloom-beacon > |think!rlk Cambridge, MA 02142 harvard >>>>>> . Thinking Machines Corp. (617)876-1111