KeyboardInterrupt and threading

Michael Hudson mwh at python.net
Mon Jan 5 11:39:24 EST 2004


q2n8byu02 at sneakemail.com (Ivan Nestlerode) writes:

> Hello comp.lang.python,
> 
> I am attempting to write a threaded program right now in Python
> (version 2.3 on Debian unstable) and the current behavior of
> KeyboardInterrupt is causing me grief. From the documentation of the
> thread module in Python 2.3.3:
> 
> "Threads interact strangely with interrupts: the KeyboardInterrupt
> exception will be received by an arbitrary thread. (When the signal
> module is available, interrupts always go to the main thread.)"

On debian, the signal module certainly should be available, and the
KeyboardInterrupt exception should go to the main thread.  Or at
least, that's what I thought.  You're definitely seeing it being
delivered to an arbitrary thread?

Cheers,
mwh

-- 
  The Programmer's Quick Guide To Python (Time Machine version):
    You try to shoot yourself in the foot, only to realize that
    there's no need, since Guido thoughtfully shot you in the foot 
    years ago.                     -- Nick Mathewson, comp.lang.python



More information about the Python-list mailing list