Signal Handler ignored on Windows NT

Ken Pier pier at parc.xerox.com
Wed Oct 20 15:26:31 EDT 1999


We have a work-around that solves this problem, courtesy of the ILU
implementation for python (ftp://ftp.parc.xerox.com/pub/ilu).  ILU
implements alarms, and setting a periodic ILU alarm interrupts the
select loop and allows the SIGINT signal handler to execute
(signal.alarm is not implemented in the NT version of python).  Since we
were already using ILU in our application, it was a freebie.

So I am happily ^Cing out of my ILU server today.  Thanks.

Gordon McMillan wrote:

> Ken Pier writes:
>
> > We are using signal.signal(signal.SIGINT, handler) to set a
> > signal handler for ControlC interrupts.  This works on UNIX
> > (Solaris2.6) and on NT if our program is interrupted during
> > time.sleep().  However, if it is interrupted during a select
> > call, the handler is called on UNIX but not on NT.
> >
> > Particulars: python1.5.2 on Sun Solaris2.6 and the compiled
> > version out of py152.exe on NT 4.0, Service Pack 5.
> >
> > Advice?
>
> If you read the MSVC docs on signals, you'll find that you
> have very little hope of getting ^C to act as it does on Unix.
> Windows actually starts a thread to listen for ^C, and ends
> your process for you. Supposedly there's a way of interfering
> in this, but I've never gotten it to work.
>
> - Gordon

--
Ken Pier
Xerox PARC
"Nothing would ever be accomplished
were it not for unwarranted optimism."






More information about the Python-list mailing list