signal
SIGFPE
or SIGSEGV
.
SIGPIPE
is ignored (so write errors on pipes and sockets can be
reported as ordinary Python exceptions), SIGINT
is translated
into a KeyboardInterrupt
exception, and SIGTERM
is
caught so that necessary cleanup (especially sys.exitfunc
) can
be performed before actually terminating. All of these can be
overridden.
signal()
operations
in the main thread of execution. Any thread can perform an
alarm()
, getsignal()
, or pause()
; only the main
thread can set a new signal handler, and the main thread will be the
only one to receive signals (this is enforced by the Python signal
module, even if the underlying thread implementation supports sending
signals to individual threads). This means that signals can't be used
as a means of interthread communication. Use locks instead.
signal.SIGHUP
; the variable names
are identical to the names used in C programs, as found in
SIGALRM
signal be sent to the process in time seconds.
Any previously scheduled alarm is canceled (i.e. only one alarm can
be scheduled at any time). The returned value is then the number of
seconds before any previously set alarm was to have been delivered.
If time is zero, no alarm id scheduled, and any scheduled
alarm is canceled. The return value is the number of seconds
remaining before a previously scheduled alarm. If the return value
is zero, no alarm is currently scheduled. (See the UNIX man page
alarm(2)
.)
signal.SIG_IGN
, signal.SIG_DFL
or
None
. Here, signal.SIG_IGN
means that the signal was
previously ignored, signal.SIG_DFL
means that the default way
of handling the signal was previously in use, and None
means
that the previous signal handler was not installed from Python.
signal(2)
.)
signal.SIG_IGN
or
signal.SIG_DFL
. The previous signal handler will be returned
(see the description of getsignal()
above). (See the UNIX
man page signal(2)
.)
When threads are enabled, this function can only be called from the
main thread; attempting to call it from other threads will cause a
ValueError
exception to be raised.
The handler is called with two arguments: the signal number
and the current stack frame (None
or a frame object; see the
reference manual for a description of frame objects).