how to catch signals

Quinn Dunkan quinn at
Mon Mar 6 02:36:18 CET 2000

Hello!  I have a process that starts children, and perhaps kills them at some
time.  The children need to be unregistered when they die, so I set up a
SIGCHLD handler that does so.  Unfortunately, the handler doesn't always get
called, and I want to know what the safest way to catch a SIGCHLD
'synchronously' after I kill (I can't just wait() afterwards, because it's
possible someone else killed it).
I changed things to:

class Job:
    def kill(self):
        try: time.sleep(1)
        except: pass # IOError, interrupted system call

Is this recommended?  Any other approaches?  I haven't been able to figure out
why the handler wasn't being called before...


More information about the Python-list mailing list