On 02/22/2013 08:23 PM, Ian Kelly wrote:
On Fri, Feb 22, 2013 at 5:09 AM, Andrew Robinson
<andr...@r3dsolutions.com> wrote:
On 02/22/2013 07:21 PM, Ian Kelly wrote:
I am curious about how he deals with infinite loops in the generated
programs.  Probably he just kills the threads after they pass some
time threshold?
I'm under the impression that Python doesn't really allow you to kill a
thread after a time period.
It's not portable to do so....
He's using C#, not Python.  And anyway, you can cooperatively request
threads to shut down; just have the Brainfuck interpreter thread check
for a shutdown request every N cycles, or even just place the timeout
in the interpreter thread itself.
-----
1st)
It's still surprising that even C# would allow a killing of threads.

Resources can be allocated by a thread and tied up was one of the comments made on the site I linked; so those resources could be permanently tied up until process exit if the thread is killed.

eg: killing a thread is different from killing the process it is running in.

I'm not familiar enough with C# to know if it does garbage collection or not, or how de-allocation is handled; so perhaps I missed something.

------
2nd)

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?
Thanks!


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to