Hi,
How can I interrupt all running signals in a Python script? I would like something like signal.interrupt_all()
.
Is there any way to do that?
Thanks
Hi,
How can I interrupt all running signals in a Python script? I would like something like signal.interrupt_all()
.
Is there any way to do that?
Thanks
What exactly do you mean? Do you want to temporairly ignore a signal, or to completely ignore some kinds of signals?
Generally speaking, you can't "vanish" a signal once it has been generated. You either set its action to "ignore" or you block the signal, preventing it from being delivered, but you need to do this beforehand.
On POSIX systems, your options are (see Signal Concepts):
SIG_IGN
. This will also cause pending signals to be ignored (see Signal Concepts: SIG_IGN).Note that you can't interrupt a signal handler (signal-catching function); this shouldn't be a problem, as signal handlers are expected to return quickly.
See also this question: Trapping Signals in Python.