Signal problem

Fabio Durieux Lopes durieux_br at yahoo.com.br
Thu Mar 27 15:27:16 EDT 2008


  Hello again! Full of problems today!

  This one is about signal treatment. I made a daemon and set it to 
treat 2 signals: SIGALRM and SIGTERM.

   It goes like this:
   signal.signal(signal.SIGTERM, daemon.signalHandler)
   signal.signal(signal.SIGALRM, aFilter.alarmHandler)


   On daemon.py I have:
"
...
terminate = False

def signalHandler(signum, frame):
   terminate = True

...
"

   And my main loop goes like this:

   'while(not daemon.terminate):'

   When the signal treatment was in the same file as my loop it 
worked just fine, and since I've separated it in another file it 
stopped working. The SIGALRM treatment, which remains in the same 
file, is still working. Any reason why it doesn't treat SIGTERM 
anymore? Does it have anything to do with the fact that 'terminate' 
is not a class variable? Any ideas?

   Thanks in advance!




More information about the Python-list mailing list