signal.sigwaitinfo()

signal.sigwaitinfo(sigset) Suspend execution of the calling thread until the delivery of one of the signals specified in the signal set sigset. The function accepts the signal and removes it from the pending list of signals. If one of the signals in sigset is already pending for the calling thread, the function will return immediately with information about that signal. The signal handler is not called for the delivered signal. The function raises an InterruptedError if it is interrupted by

signal.sigwait()

signal.sigwait(sigset) Suspend execution of the calling thread until the delivery of one of the signals specified in the signal set sigset. The function accepts the signal (removes it from the pending list of signals), and returns the signal number. Availability: Unix (see the man page sigwait(3) for further information). See also pause(), pthread_sigmask(), sigpending(), sigwaitinfo() and sigtimedwait(). New in version 3.3.

signal.sigtimedwait()

signal.sigtimedwait(sigset, timeout) Like sigwaitinfo(), but takes an additional timeout argument specifying a timeout. If timeout is specified as 0, a poll is performed. Returns None if a timeout occurs. Availability: Unix (see the man page sigtimedwait(2) for further information). See also pause(), sigwait() and sigwaitinfo(). New in version 3.3. Changed in version 3.5: The function is now retried with the recomputed timeout if interrupted by a signal not in sigset and the signal handle

signal.sigpending()

signal.sigpending() Examine the set of signals that are pending for delivery to the calling thread (i.e., the signals which have been raised while blocked). Return the set of the pending signals. Availability: Unix (see the man page sigpending(2) for further information). See also pause(), pthread_sigmask() and sigwait(). New in version 3.3.

signal.signal()

signal.signal(signalnum, handler) Set the handler for signal signalnum to the function handler. handler can be a callable Python object taking two arguments (see below), or one of the special values 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 Valu

signal.siginterrupt()

signal.siginterrupt(signalnum, flag) Change system call restart behaviour: if flag is False, system calls will be restarted when interrupted by signal signalnum, otherwise system calls will be interrupted. Returns nothing. Availability: Unix (see the man page siginterrupt(3) for further information). Note that installing a signal handler with signal() will reset the restart behaviour to interruptible by implicitly calling siginterrupt() with a true flag value for the given signal.

signal.set_wakeup_fd()

signal.set_wakeup_fd(fd) Set the wakeup file descriptor to fd. When a signal is received, the signal number is written as a single byte into the fd. This can be used by a library to wakeup a poll or select call, allowing the signal to be fully processed. The old wakeup fd is returned. fd must be non-blocking. It is up to the library to remove any bytes before calling poll or select again. Use for example struct.unpack('%uB' % len(data), data) to decode the signal numbers list. When threads a

signal.setitimer()

signal.setitimer(which, seconds[, interval]) Sets given interval timer (one of signal.ITIMER_REAL, signal.ITIMER_VIRTUAL or signal.ITIMER_PROF) specified by which to fire after seconds (float is accepted, different from alarm()) and after that every interval seconds. The interval timer specified by which can be cleared by setting seconds to zero. When an interval timer fires, a signal is sent to the process. The signal sent is dependent on the timer being used; signal.ITIMER_REAL will delive

signal.pthread_sigmask()

signal.pthread_sigmask(how, mask) Fetch and/or change the signal mask of the calling thread. The signal mask is the set of signals whose delivery is currently blocked for the caller. Return the old signal mask as a set of signals. The behavior of the call is dependent on the value of how, as follows. SIG_BLOCK: The set of blocked signals is the union of the current set and the mask argument. SIG_UNBLOCK: The signals in mask are removed from the current set of blocked signals. It is permiss

signal.pthread_kill()

signal.pthread_kill(thread_id, signalnum) Send the signal signalnum to the thread thread_id, another thread in the same process as the caller. The target thread can be executing any code (Python or not). However, if the target thread is executing the Python interpreter, the Python signal handlers will be executed by the main thread. Therefore, the only point of sending a signal to a particular Python thread would be to force a running system call to fail with InterruptedError. Use threading.