{
    "mode": "pydoc",
    "parameter": "_signal",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/_signal/json",
    "generated": "2026-06-02T15:04:36Z",
    "sections": {
        "NAME": {
            "content": "signal - This module provides mechanisms to use signal handlers in Python.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Functions:\n",
            "subsections": [
                {
                    "name": "alarm",
                    "content": ""
                },
                {
                    "name": "setitimer",
                    "content": "float time and the timer may restart then [Unix only]"
                },
                {
                    "name": "getitimer",
                    "content": ""
                },
                {
                    "name": "signal",
                    "content": ""
                },
                {
                    "name": "getsignal",
                    "content": ""
                },
                {
                    "name": "pause",
                    "content": ""
                },
                {
                    "name": "default_int_handler",
                    "content": "signal constants:\nSIGDFL -- used to refer to the system default handler\nSIGIGN -- used to ignore the signal\nNSIG -- number of defined signals\nSIGINT, SIGTERM, etc. -- signal numbers\n\nitimer constants:\nITIMERREAL -- decrements in real time, and delivers SIGALRM upon\nexpiration\nITIMERVIRTUAL -- decrements only when the process is executing,\nand delivers SIGVTALRM upon expiration\nITIMERPROF -- decrements both when the process is executing and\nwhen the system is executing on behalf of the process.\nCoupled with ITIMERVIRTUAL, this timer is usually\nused to profile the time spent by the application\nin user and kernel space. SIGPROF is delivered upon\nexpiration.\n\n\n* IMPORTANT NOTICE *\nA signal handler function is called with two arguments:\nthe first is the signal number, the second is the interrupted stack frame.\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "alarm",
                    "content": "Arrange for SIGALRM to arrive after the given number of seconds.\n"
                },
                {
                    "name": "default_int_handler",
                    "content": "The default handler for SIGINT installed by Python.\n\nIt raises KeyboardInterrupt.\n"
                },
                {
                    "name": "getitimer",
                    "content": "Returns current value of given itimer.\n"
                },
                {
                    "name": "getsignal",
                    "content": "Return the current action for the given signal.\n\nThe return value can be:\nSIGIGN -- if the signal is being ignored\nSIGDFL -- if the default action for the signal is in effect\nNone    -- if an unknown handler is in effect\nanything else -- the callable Python object used as a handler\n"
                },
                {
                    "name": "pause",
                    "content": "Wait until a signal arrives.\n"
                },
                {
                    "name": "pidfd_send_signal",
                    "content": "Send a signal to a process referred to by a pid file descriptor.\n"
                },
                {
                    "name": "pthread_kill",
                    "content": "Send a signal to a thread.\n"
                },
                {
                    "name": "pthread_sigmask",
                    "content": "Fetch and/or change the signal mask of the calling thread.\n"
                },
                {
                    "name": "raise_signal",
                    "content": "Send a signal to the executing process.\n"
                },
                {
                    "name": "set_wakeup_fd",
                    "content": "setwakeupfd(fd, *, warnonfullbuffer=True) -> fd\n\nSets the fd to be written to (with the signal number) when a signal\ncomes in.  A library can use this to wakeup select or poll.\nThe previous fd or -1 is returned.\n\nThe fd must be non-blocking.\n"
                },
                {
                    "name": "setitimer",
                    "content": "Sets given itimer (one of ITIMERREAL, ITIMERVIRTUAL or ITIMERPROF).\n\nThe timer will fire after value seconds and after that every interval seconds.\nThe itimer can be cleared by setting seconds to zero.\n\nReturns old values as a tuple: (delay, interval).\n"
                },
                {
                    "name": "siginterrupt",
                    "content": "Change system call restart behaviour.\n\nIf flag is False, system calls will be restarted when interrupted by\nsignal sig, else system calls will be interrupted.\n"
                },
                {
                    "name": "signal",
                    "content": "Set the action for the given signal.\n\nThe action can be SIGDFL, SIGIGN, or a callable Python object.\nThe previous action is returned.  See getsignal() for possible return values.\n\n* IMPORTANT NOTICE *\nA signal handler function is called with two arguments:\nthe first is the signal number, the second is the interrupted stack frame.\n"
                },
                {
                    "name": "sigpending",
                    "content": "Examine pending signals.\n\nReturns a set of signal numbers that are pending for delivery to\nthe calling thread.\n"
                },
                {
                    "name": "sigtimedwait",
                    "content": "Like sigwaitinfo(), but with a timeout.\n\nThe timeout is specified in seconds, with floating point numbers allowed.\n"
                },
                {
                    "name": "sigwait",
                    "content": "Wait for a signal.\n\nSuspend execution of the calling thread until the delivery of one of the\nsignals specified in the signal set sigset.  The function accepts the signal\nand returns the signal number.\n"
                },
                {
                    "name": "sigwaitinfo",
                    "content": "Wait synchronously until one of the signals in *sigset* is delivered.\n\nReturns a structsiginfo containing information about the signal.\n"
                },
                {
                    "name": "strsignal",
                    "content": "Return the system description of the given signal.\n\nThe return values can be such as \"Interrupt\", \"Segmentation fault\", etc.\nReturns None if the signal is not recognized.\n"
                },
                {
                    "name": "valid_signals",
                    "content": "Return a set of valid signal numbers on this platform.\n\nThe signal numbers returned by this function can be safely passed to\nfunctions like `pthreadsigmask`.\n"
                }
            ]
        },
        "DATA": {
            "content": "ITIMERPROF = 2\nITIMERREAL = 0\nITIMERVIRTUAL = 1\nNSIG = 65\nSIGABRT = 6\nSIGALRM = 14\nSIGBUS = 7\nSIGCHLD = 17\nSIGCLD = 17\nSIGCONT = 18\nSIGFPE = 8\nSIGHUP = 1\nSIGILL = 4\nSIGINT = 2\nSIGIO = 29\nSIGIOT = 6\nSIGKILL = 9\nSIGPIPE = 13\nSIGPOLL = 29\nSIGPROF = 27\nSIGPWR = 30\nSIGQUIT = 3\nSIGRTMAX = 64\nSIGRTMIN = 34\nSIGSEGV = 11\nSIGSTOP = 19\nSIGSYS = 31\nSIGTERM = 15\nSIGTRAP = 5\nSIGTSTP = 20\nSIGTTIN = 21\nSIGTTOU = 22\nSIGURG = 23\nSIGUSR1 = 10\nSIGUSR2 = 12\nSIGVTALRM = 26\nSIGWINCH = 28\nSIGXCPU = 24\nSIGXFSZ = 25\nSIGBLOCK = 0\nSIGDFL = 0\nSIGIGN = 1\nSIGSETMASK = 2\nSIGUNBLOCK = 1\n",
            "subsections": []
        },
        "FILE": {
            "content": "(built-in)\n\n",
            "subsections": []
        }
    },
    "summary": "signal - This module provides mechanisms to use signal handlers in Python.",
    "flags": [],
    "examples": [],
    "see_also": []
}