how to run an arbitrary function with timeout?

Garry Hodgson garry at sage.att.com
Fri May 14 13:54:41 EDT 2004


"Tim Peters" <tim.one at comcast.net> wrote:

> Best I can guess, you're expecting something that can't happen, but I'm not
> sure exactly what.

ok, let me rephrase my question.

i would like a function RunWithTimeout( func, args, timeout )
i would like it to invoke the function func on arguments args.
if timeout seconds elapse before func(args) returns, i would
like it to raise an exception.  if func(args) returns before timeout
seconds, i would like it return the result.

can anyone help?

thanks

----
Garry Hodgson, Technology Consultant, AT&T Labs

Be happy for this moment.
This moment is your life.




More information about the Python-list mailing list