Python signal handling

Michael Hudson mwh at python.net
Wed Apr 17 10:26:05 EDT 2002


Dave Swegen <dswegen at software.plasmon.com> writes:

> I've recently been bitten by a nasty (undocumented) feature in Perl,
> where installing a signal handler to catch SIGCHLD will eventually cause
> a core dump. So before I venture into any daemon handling in python I
> was wondering if Python too suffers from problems with signal handling?

Python suffers from problems with signal handling, but it sounds like
they're not the same problems as those suffered by perl.

> I believe the reason for perl's problem is that it isn't re-entrant, and
> thus two rapidly incoming signals will cause perl to fo *Pooof*.

In Python, signal handlers (usually) get run in between opcodes, so if
an opcode takes a particularly long time to run, your signal handler
may not run until some time after the OS delivers the signal to your
process.

Cheers,
M.

-- 
  ARTHUR:  Why should a rock hum?
    FORD:  Maybe it feels good about being a rock.
                    -- The Hitch-Hikers Guide to the Galaxy, Episode 8



More information about the Python-list mailing list