Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge remote branch 'rtyler/master'

  • Loading branch information...
commit e1acddd504a12240aeb8df4079cb272aa2fc10ac 2 parents 9075dc6 + 056423c
Travis Parker teepark authored

Showing 1 changed file with 42 additions and 0 deletions. Show diff stats Hide diff stats

  1. +42 0 README.markdown
42 README.markdown
Source Rendered
... ... @@ -0,0 +1,42 @@
  1 +itimer
  2 +=======
  3 +
  4 +The `itimer` module adds support for sub-second alarm signal delivery
  5 +on systems that support `setitimer(2)` and `getitimer(2)`. Usage is
  6 +very similar to sending alarm signals with the built-in `signal` module:
  7 +
  8 + import itimer
  9 + import signal
  10 + import time
  11 +
  12 + def handler(*args, **kwargs):
  13 + print 'Alarm! (%s)' % time.time()
  14 +
  15 + def main():
  16 + signal.signal(signal.SIGALRM, handler)
  17 +
  18 + cont = True
  19 + while cont:
  20 + try:
  21 + time.sleep(1)
  22 + itimer.alarm(0.5)
  23 + except KeyboardInterrupt:
  24 + cont = False
  25 + return 0
  26 +
  27 + if __name__ == '__main__':
  28 + exit(main())
  29 +
  30 +(The example above will fire SIGALRM signals every 0.5s)
  31 +
  32 +
  33 +License
  34 +========
  35 +
  36 +See the `LICENSE` file
  37 +
  38 +
  39 +Authors
  40 +=========
  41 +
  42 +`itimer` was originally written by Libor Michalek at [Slide, Inc.](http://github.com/slideinc)

0 comments on commit e1acddd

Please sign in to comment.
Something went wrong with that request. Please try again.