title: python: windows equivalent of SIGALRM
body: <p>I have this decorator:</p>
  
  <pre><code>def timed_out(timeout):
      def decorate(f):
          if not hasattr(signal, "SIGALRM"):
              return f
  
          def handler(signum, frame):
              raise TimedOutExc()
  
          @functools.wraps(f)
          def new_f(*args, **kwargs):
              old = signal.signal(signal.SIGALRM, handler)
              signal.alarm(timeout)
              try:
                  result = f(*args, **kwargs)
              finally:
                  signal.signal(signal.SIGALRM, old)
              signal.alarm(0)
              return result
  
          new_f.func_name = f.func_name
          return new_f
  
      return decorate
  </code></pre>
  
  <p>The code only does anything on linux, though, as on windows, there is no <code>SIGALRM</code>. What would be the simplest way to have this code work in Windows as well?</p>