Date: Wed, 14 Jan 1998 17:51:13 +0200 (IST) From: Eli Zaretskii To: Paul Derbyshire Cc: djgpp AT delorie DOT com Subject: Re: SIGQUIT: What's it good for, anyway? In-Reply-To: <69i9s5$9t2@freenet-news.carleton.ca> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Precedence: bulk On 14 Jan 1998, Paul Derbyshire wrote: > What is Yet Another Interrupt Key good for anyway? Already there are ^C > and ^Break with SIGINT; now 2.02 proposes to add ^\ and SIGQUIT. First, SIGQUIT is actually generated on Unix by Ctrl-\, it's not an invention. But more to the point, here's an example: Let's say you have a program which talks to the user through an interpreter, and lets them type procedures, or load them from a file, and then run them. Let's say that you want to let the user break out of a runaway computation. So you use SIGINT for that (install a handler which longjmp's to the top-level command loop which reads input from the keyboard). And now let's say that you come up with this terrific idea to allow them to interrupt a lengthy, possibly runaway, computation, but also allow to resume it if they so choose, after typing some commands (to see whether things are just lengthy or indeed runaway). You need another signal that can be generated by a key. SIGINT is no good, since you cannot easily tell if it came from Ctrl-C or Ctrl-BREAK. On Unix you use SIGQUIT. What do you do with DJGPP? Short of installing your own hardware keyboard handler, you have no options. Isn't this irritating to know that DJGPP already hooks the keyboard interrupt, and is a few opcodes away of what you need? The above is a real example, btw, from a real program.