Paul Boddie wrote:
> Michael Yanowitz wrote:
>>
>>I guess I am looking for something portable (both
>> Windows and Linux) where I can abort a function after
>> a certain time limit expires.
>
> Doing a search for "timeout function Python" on Google reveals a number
> of approaches.
> Using
Michael Yanowitz wrote:
>
>I guess I am looking for something portable (both
> Windows and Linux) where I can abort a function after
> a certain time limit expires.
Doing a search for "timeout function Python" on Google reveals a number
of approaches.
Using signals:
* http://nick.vargish.o
.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf
Of Benjamin Niemann
Sent: Monday, January 22, 2007 11:19 AM
To: python-list@python.org
Subject: Re: Is there a better way to implement this:
Michael Yanowitz wrote:
> Hello:
>
>I wrote the code be
ected - exceptions are local to a thread and there is
currently no (portable) way to raise an exception in another thread.
> What am I missing, or is there a better way to
> implement this (having ftimed() return when the
> abort-timer time is exceeded?
You may use the signal.alarm() funct
tinue and not return?
What am I missing, or is there a better way to
implement this (having ftimed() return when the
abort-timer time is exceeded?
import time, thread, sys
thread_finished = "MAX RUN TIME EXCEEDED!"
def abort (seconds):
start_time = time.time()
wh