Python:Windows中的SIGALRM和setitimer

时间:2013-10-21 10:53:17

标签: python python-2.7 setitimer

以下代码适用于Unix,但我想将其转移到Windows操作系统。问题是在Windows signal.SIGALRMsignal.setitimer中无法正常工作。如果有人可以帮助我,我会非常高兴。

def handler(signum, frame):
   counter += 1
   print(counter)


signal.signal(signal.SIGALRM, handler)
signal.setitimer(signal.ITIMER_REAL, UPDATE_INTERVAL, UPDATE_INTERVAL)


for i in xrange(10):
    # Wait for signal to be received
    signal.pause()

# Print the stop time, in case you wanted to know.
_initTime()
print "Stop:", _now()

signal.setitimer(signal.ITIMER_REAL, 0)

0 个答案:

没有答案