[IronPython] Time out

Michael Foord fuzzyman at voidspace.org.uk
Mon Jul 26 17:44:10 CEST 2010


On 26/07/2010 15:51, Scott Holden wrote:
> I'm currently dealing with the same issue.  So far, a separate thread 
> is the only thing I've come up with, but Thread.Abort seems a bit 
> drastic, and may be hazardous to your health...  Is there a safer way?
>
I've not had problems with use of Thread.Abort. You could do it another 
process altogether of course... Not aware of any easy alternatives.

Michael

> On Fri, Jul 23, 2010 at 8:57 AM, Michael Foord 
> <fuzzyman at voidspace.org.uk <mailto:fuzzyman at voidspace.org.uk>> wrote:
>
>     On 23/07/2010 14:49, Saeli Mathieu wrote:
>>     Hello,
>>
>>     I'm sending this email to get more information about a specific
>>     using of ironPython.
>>     I'm working on a Silverlight 4 project and I'm using IronPython
>>     to execute script inside my C# code.
>>
>>     The main objective is to allow users to code an AI and send it
>>     into our application.
>>     The AI will use the C# we made.
>>     That's works fine. :)
>>
>>     But I want to prevent the user to create an infinite loop.
>>     I browsed the Online documentation but I couldn't find any
>>     information about "time out execution"
>>
>>     Func<bool> func = scope.GetVariable<Func<bool> >("MainLoop");
>>     this.Result = func().ToString();
>>
>>     this.Result will contain a string with the error of the Python
>>     Script if something wrong appended. ex: indentation or anything else.
>>
>>     but I want to make the method scope.GetVariable<>() time out if
>>     the script contain an infinite loop.
>>
>>     Does anybody know something about that ?
>     The only way I can think of doing it is to execute the code on a
>     different thread and then abort the thread if it exceeds the timeout.
>
>     Michael
>
>>
>>     Sincerely
>>     -- 
>>     Saeli Mathieu.
>>
>>     +33 6 45 32 78 47
>>     {Epitech} 2012
>>     Permanent GDL
>>     http://www.gamelab.epitech.net/
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
>>     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>     -- 
>     http://www.ironpythoninaction.com/
>
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
>     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100726/ece5b3e7/attachment.html>


More information about the Ironpython-users mailing list