Skip to content Skip to sidebar Skip to footer

Python Timer Mystery

Well, at least a mystery to me. Consider the following: import time import signal def catcher(signum, _): print 'beat!' signal.signal(signal.SIGALRM, catcher) signal.setitim

Solution 1:

The signal.ITIMER_VIRTUAL only counts down with the process is running. time.sleep(5) suspends the process so the timer doesn't decrement.


Post a Comment for "Python Timer Mystery"