Module signal
[hide private]
[frames] | no frames]

Module signal

This module provides mechanisms to use signal handlers in Python.

Functions:

alarm() -- cause SIGALRM after a specified time [Unix only] signal() -- set the action for a given signal getsignal() -- get the signal action for a given signal pause() -- wait until a signal arrives [Unix only] default_int_handler() -- default SIGINT handler

Constants:

SIG_DFL -- used to refer to the system default handler SIG_IGN -- used to ignore the signal NSIG -- number of defined signals

SIGINT, SIGTERM, etc. -- signal numbers

*** IMPORTANT NOTICE *** A signal handler function is called with two arguments: the first is the signal number, the second is the interrupted stack frame.

Functions [hide private]
 
alarm(seconds)
Arrange for SIGALRM to arrive after the given number of seconds.
 
default_int_handler(...)
The default handler for SIGINT installed by Python.
action
getsignal(sig)
Return the current action for the given signal.
 
pause()
Wait until a signal arrives.
action
signal(sig, action)
Set the action for the given signal.
Variables [hide private]
  NSIG = 65
  SIGABRT = 6
  SIGALRM = 14
  SIGBUS = 7
  SIGCHLD = 17
  SIGCLD = 17
  SIGCONT = 18
  SIGFPE = 8
  SIGHUP = 1
  SIGILL = 4
  SIGINT = 2
  SIGIO = 29
  SIGIOT = 6
  SIGKILL = 9
  SIGPIPE = 13
  SIGPOLL = 29
  SIGPROF = 27
  SIGPWR = 30
  SIGQUIT = 3
  SIGRTMAX = 64
  SIGRTMIN = 34
  SIGSEGV = 11
  SIGSTOP = 19
  SIGSYS = 31
  SIGTERM = 15
  SIGTRAP = 5
  SIGTSTP = 20
  SIGTTIN = 21
  SIGTTOU = 22
  SIGURG = 23
  SIGUSR1 = 10
  SIGUSR2 = 12
  SIGVTALRM = 26
  SIGWINCH = 28
  SIGXCPU = 24
  SIGXFSZ = 25
  SIG_DFL = 0
  SIG_IGN = 1
Function Details [hide private]

default_int_handler(...)

 

The default handler for SIGINT installed by Python. It raises KeyboardInterrupt.

getsignal(sig)

 

Return the current action for the given signal. The return value can be: SIG_IGN -- if the signal is being ignored SIG_DFL -- if the default action for the signal is in effect None -- if an unknown handler is in effect anything else -- the callable Python object used as a handler

Returns: action

signal(sig, action)

 

Set the action for the given signal. The action can be SIG_DFL, SIG_IGN, or a callable Python object. The previous action is returned. See getsignal() for possible return values.

*** IMPORTANT NOTICE *** A signal handler function is called with two arguments: the first is the signal number, the second is the interrupted stack frame.

Returns: action