signal module?
Daniel Nielsen
djn at daimi.au.dk
Thu Mar 27 04:23:38 EST 2003
Hi.
I'm currently working on some code that uses the signal module... But
I doesnt seem to work proberly.
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:
signal.signal(signal.SIGINT, gp.handler);
where gp is a module and handler looks like:
def handler(signum, frame):
print "Handling signal: " + signum;
sys.exit(2);
But ctrl-c doesnt do anything!
If I write:
signal.signal(signal.SIGINT, signal.SIG_DFL);
instead, ctrl-c actually terminates the program...
Have I misunderstood something?
/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