Use apply and update to get and set handlers.
Use apply and update to get and set handlers.
Given a number of seconds, a signal, and a function: sets up a handler which upon receiving the signal once, calls the function with argument true, and if the signal is received again within the allowed time, calls it with argument false.
Given a number of seconds, a signal, and a function: sets up a handler which upon receiving the signal once, calls the function with argument true, and if the signal is received again within the allowed time, calls it with argument false. (Otherwise it calls it with true and starts the timer over again.)
Signals which are either inaccessible or which seem like particularly bad choices when looking for an open one.