11

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.

Galen
  • 1,307
  • 8
  • 15
Louis
  • 111
  • 1
  • 3

1 Answers1

16

Use signal.setitimer() instead.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • So I am curious why Python's `signal` module does not have an interface for `ualarm()`...just because `setitimer` can generate signals other that `SIGALRM`? – Mr. Shickadance Jun 09 '11 at 16:50
  • No idea. Maybe it's not available on many platforms or something. I suggest to post a question instead of a comment. – Aaron Digulla Jun 10 '11 at 11:44