问题
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