Path: utzoo!attcan!utgpu!watmath!att!dptg!rutgers!usc!cs.utexas.edu!csd4.csd.uwm.edu!mailrus!ncar!ico!auto-trol!marbru From: marbru@auto-trol.UUCP (Martin Brunecky) Newsgroups: comp.windows.x Subject: Re: getting CONTROL C to interrupt X application Message-ID: <261@auto-trol.UUCP> Date: 30 Aug 89 22:41:56 GMT References: <8908231747.AA20273@ATHENA.MIT.EDU> <525@granite.dec.com> <2395@auspex.auspex.com> Reply-To: marbru@auto-trol.UUCP (Martin Brunecky) Organization: Auto-trol Technology, Denver Lines: 26 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. Be carefull about what X calls you use to scan the queue - you probbably don't want to flush your output everytime you look for a control C. Also, you may SCAN the queue for control C even when you are NOT going to dispatch any event. ############################################################################### Martin Brunecky, Auto-trol Technology Corporation, 12500 North Washington Street, Denver, CO-80241-2404 (303) 252-2499 ncar!ico!auto-trol!marbru ###############################################################################