Async-signal safe functions in signal handlers (unix)

Diez B. Roggisch deetsNOSPAM at web.de
Mon Jan 3 08:10:15 EST 2005


> So, is there a) any mechanism inside Python that can detect if the
> current code is executed in a signal handler, or b) a list of
> statements that must not be used in a Python signal handler in order
> to avoid glibc function calls that are not async-signal safe?

The execution of signal handlers in python is not done really asynchronous -
instead, an incoming signal is noticed and flagged to the interpreters byte
code loop - so the signal gets dealed with when the current bytecode
instruction is termintated. Read section 7.1 in the docs about the signal
module.

In other words: Don't worry, be happy.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list