signal.alarm()
signal.alarm() is a Python function in the Signal Module category. Sets a SIGALRM timer in seconds. Only one alarm can be pending. The syntax is signal.alarm(time). Parameters: time — seconds before alarm. Returns: Previous alarm time. A typical example: signal.alarm(5) # SIGALRM in 5 seconds. A close sibling is signal.signal(), which sets a handler for a signal (like SIGINT, SIGTERM). A close sibling is signal.pause(), which blocks until a signal is received (Unix only). A close sibling is signal.setitimer(), which sets an interval timer with microsecond precision. A close sibling is signal.getsignal(), which returns the current signal handler for a given signal. More about this category: Async event handling — signal, alarm, pause, setitimer. Related Signal Module entries: signal.signal(), signal.pause(), signal.setitimer(), signal.getsignal(), signal.SIG_DFL, signal.SIG_IGN. This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.