Signal Handler ignored on Windows NT
Gordon McMillan
gmcm at hypernet.com
Wed Oct 20 08:52:28 EDT 1999
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
More information about the Python-list
mailing list