FYI: AI-programmer

Oscar Benjamin oscar.j.benjamin at gmail.com
Fri Feb 22 16:32:33 EST 2013


On 22 February 2013 13:04, Andrew Robinson <andrew3 at r3dsolutions.com> wrote:
>
> How would you get an interpreter thread to check for a shutdown request
> every N cycles?
> I've read about how to set a timeout based on time, but not on any kind of
> cycle (eg: instruction cycle?) count.
>
> Do you have a python example?

while True:
    for n in range(N):
        if process_cycle() == END:
            return
    if shutdown():
        raise ShutDownError


Oscar



More information about the Python-list mailing list