signal.alarm function with resolution greater than 1 second?

大城市里の小女人 提交于 2019-12-01 00:51:18

问题


I'm trying to build a python timeout exception that runs in milliseconds.

The python signal.alarm function has a 1 second resolution.

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.

Thanks in advance for your input.


回答1:


Use signal.setitimer() instead.



来源:https://stackoverflow.com/questions/3770711/signal-alarm-function-with-resolution-greater-than-1-second

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!