分辨率大于1秒的signal.alarm功能? [英] signal.alarm function with resolution greater than 1 second?
本文介绍了分辨率大于1秒的signal.alarm功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试建立一个以毫秒为单位的python超时异常。
I'm trying to build a python timeout exception that runs in milliseconds.
python signal.alarm函数的分辨率为1秒。
The python signal.alarm function has a 1 second resolution.
如何获得等效函数,以毫秒为单位(而不是秒),向给定进程请求SIGALRM信号?
How would one get an equivalent function that requests a SIGALRM signal to a given process in, say milliseconds, as opposed to seconds?
到目前为止,我还没有找到简单的解决方案。
I've found no simple solutions as of yet.
谢谢您的输入。
推荐答案
使用 signal.setitimer()代替。
这篇关于分辨率大于1秒的signal.alarm功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文