Problem with trapping SIGALRM
Chung Kuo
bnewell at linux.chungkuo.org
Sat Apr 28 14:50:15 EDT 2001
I'm having some difficulty with an alarm() situation. Here is what I tried:
import os, sys, signal
if __name == __main__:
try:
signal.alarm(60)
os.system('/usr/games/quill')
except:
os.system('killall quill')
This fails when the alarm goes off because the except doesn't catch the
SIGALRM. If I add a signal(signal.SIGALRM, handler) the handler of course
catches the SIGALRM, but doesn't process it until AFTER the os.system
call (usr/games/quill) completes! (The docs seem to imply this, that
handlers only operate between Python atomic operations.)
Can anyone say what I've got wrong here or suggest a way to do what I
am trying to do?
Thanks in advance.
More information about the Python-list
mailing list