python timer mystery

前端 未结 2 1988
深忆病人
深忆病人 2021-01-18 00:33

Well, at least a mystery to me. Consider the following:

import time
import signal

def catcher(signum, _):
    print \"beat!\"

signal.signal(signal.SIGALRM         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 01:11

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

提交回复
热议问题