Re: Timing out arbitrary functions

2005-12-28 Thread antti kervinen
AOP would be a quite elegant way set timeouts for functions, in my opinion. The nice thing in it is that, in principle, you can write a single timeout advice code and then wrap it over any function you want to timeout. I wrote timeout_advice.py to demonstrate this a couple of years ago (see http:/

Re: Timing out arbitrary functions

2005-12-24 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > > Is something stopping you from using sigalarm? > > Pure ignorance of its existence. > Thanks, I'll check it out. Two things to keep in mind: - You can have only ONE alarm pending for the whole process. If different things in the program need tim

Re: Timing out arbitrary functions

2005-12-24 Thread Steven D'Aprano
On Sat, 24 Dec 2005 04:47:34 -0800, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> How do others handle something like this? What should I be looking for? >> I'm after a lightweight solution, if any such thing exists. > > Is something stopping you from using sigalarm? Pure ig

Re: Timing out arbitrary functions

2005-12-24 Thread David Wahler
Steven D'Aprano wrote: > I have a problem and I don't know where to start looking for a solution. > > I have a class that needs to call an arbitrary function and wait for a > result. The function, being completely arbitrary and not under my control, > may be very time consuming and possibly may not

Re: Timing out arbitrary functions

2005-12-24 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > How do others handle something like this? What should I be looking for? > I'm after a lightweight solution, if any such thing exists. Is something stopping you from using sigalarm? -- http://mail.python.org/mailman/listinfo/python-list

Timing out arbitrary functions

2005-12-24 Thread Steven D'Aprano
I have a problem and I don't know where to start looking for a solution. I have a class that needs to call an arbitrary function and wait for a result. The function, being completely arbitrary and not under my control, may be very time consuming and possibly may not even halt. My class needs to be