<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 23/07/2010 14:49, Saeli Mathieu wrote:
<blockquote
 cite="mid:AANLkTikYvdaDr=G8YwegJ_Y7OPMtdbcLoYofx2zwnqmb@mail.gmail.com"
 type="cite">Hello,
  <div><br>
  </div>
  <div>I'm sending this email to get more information about a specific
using of ironPython.</div>
  <div>I'm working on a Silverlight 4 project and I'm using IronPython
to&nbsp;execute&nbsp;script inside my C# code.</div>
  <div><br>
  </div>
  <div>The main&nbsp;objective&nbsp;is to allow users to code an AI and send it
into our application.</div>
  <div>The AI will use the C# we made.</div>
  <div>That's works fine. :)</div>
  <div><br>
  </div>
  <div>But I want to prevent the user to create an infinite loop.</div>
  <div>I browsed the Online documentation but I couldn't find any
information about "time out execution"</div>
  <div><br>
  </div>
  <div>Func&lt;bool&gt; func = scope.GetVariable&lt;Func&lt;bool&gt;
&gt;("MainLoop");</div>
  <div>this.Result = func().ToString();</div>
  <div><br>
  </div>
  <div>this.Result will contain a string with the error of the Python
Script if something wrong&nbsp;appended. ex: indentation or anything else.</div>
  <div><br>
  </div>
  <div>but I want to make the method scope.GetVariable&lt;&gt;() time
out if the script contain an infinite loop.</div>
  <div><br>
  </div>
  <div>Does anybody know something about that ?</div>
</blockquote>
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.<br>
<br>
Michael<br>
<br>
<blockquote
 cite="mid:AANLkTikYvdaDr=G8YwegJ_Y7OPMtdbcLoYofx2zwnqmb@mail.gmail.com"
 type="cite">
  <div><br>
  </div>
  <div>Sincerely</div>
  <div>-- <br>
Saeli Mathieu.<br>
  <br>
+33 6 45 32 78 47<br>
{Epitech} 2012<br>
Permanent GDL<br>
  <a moz-do-not-send="true" href="http://www.gamelab.epitech.net/">http://www.gamelab.epitech.net/</a><br>
  </div>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>
<a class="moz-txt-link-freetext" href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a></pre>
</body>
</html>