From: broeker AT acp3bf DOT knirsch DOT de (Hans-Bernhard Broeker) Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems using signals Date: 7 Oct 1999 17:56:43 +0200 Organization: RWTH Aachen, III. physikalisches Institut B Lines: 34 Message-ID: <7tifrr$3kn@acp3bf.knirsch.de> References: <01BF10C3 DOT 98917580 AT tim DOT polyhedra DOT com> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 939311808 18871 137.226.32.75 (7 Oct 1999 15:56:48 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 7 Oct 1999 15:56:48 GMT X-Newsreader: TIN [version 1.2 PL2] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Tim Bedding (tim AT polyhedra DOT com) wrote: > Due to a mistake, I ran a program containing > a tight loop. This simple program did not explicitly define > or call any signal functions. > I could not interrupt the program using Ctrl-C. > Is this to be expected? Yes. Unlike in a 'real' operating system, keyboard-generated signals in MS-DOS don't generally get delivered until the point were a program reads the keyboard, or does any other kind of I/O. The underlying problem is that your program is in protected mode (almost) all the time, i.e. it doesn't call or use DOS at all. If DOS isn't doing any work, it cannot detect the Ctrl-C keypress deliver an interrupt to your program. > Is there a way to program or compile in order to make sure that the > program is always interruptable somehow? The program is interruptible by another key, *if* that's the first key you press: Ctrl-Break is translated to an interrupt request in the BIOS (or keyboard processor, I'm not sure), and will be serviced immediately, at all times. Same for Ctrl-Alt-Del (which may not do what you actually want :-). To get 'interruptability', just check for keypresses from time to time. (Every 'n'-th iteration of the inner loop, for some suitable value of 'n'). -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.