signal module?
Daniel Nielsen
djn at daimi.au.dk
Thu Mar 27 05:05:25 EST 2003
On 27/03-03 10.55, Martin v. Löwis wrote:
> > I'm using threads, so I'd like ctrl-c to actually terminate the
> > program. If my memory serves me, ctrl-c is SIGINT, so in my code, in
> > the main thread, I write:
>
> Notice that Python already binds SIGINT, to install a handler that raises
> a KeyboardInterrupt.
>
I realise this, but that handler doesnt get the signal either...
From: http://www.python.org/doc/current/lib/module-thread.html
"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.)"
I don't know what to make of this, except that KeyboardInterrupt isn't
always raised in the main thread, unless you use the signal module
somehow.
/Daniel
--
There are no great men, only great challenges that ordinary men are forced
by circumstances to meet.
-- Admiral William Halsey
More information about the Python-list
mailing list