signal.alarm() for less than one second?

Jarkko Torppa torppa at polykoira.megabaud.fi
Mon Jul 8 18:12:10 EDT 2002


Jarkko Torppa <torppa at staff.megabaud.fi> wrote in message news:<ag7sdr$p7q$2 at phys-news1.kolumbus.fi>...
> In article <slrnaiehb9.5bc.ak at ak.silmarill.org>, Andrei Kulakov wrote:
> > It looks like signal.alarm takes 1+ seconds as argument. I need
> > something lower, like 0.5 second or so.
> 
> Usual way to do input timeouts on unix is to use select.
> 
> there is also setitimer syscall but it does not seem to be
> wrapped into anything.

I made an extension module for itimer, it has these functions

  alarm(seconds) -- deliver alarm with subsecond precission
  setitimer(which,secs,interval) -- setitimer to fire
  getitimer(which) -- get current value of timer

Grab from http://polykoira.megabaud.fi/~torppa/py-itimer/



More information about the Python-list mailing list