[IronPython] Time out
Saeli Mathieu
saeli.mathieu at gmail.com
Tue Jul 27 16:39:31 CEST 2010
I found a way to solve this problem :)
Pretty easy :)
public class MyThreadHandle
{
#region
//Your properties here :)
public String Error;
#endregion
//use the constructor to init your properties
public MyThreadHandle(PythonEditor pythonEngine)
{
this.pyEngine = pythonEngine;
}
//You can use another methode to change the values of your properties
public void SetParam(var a, var b, var c,...etc)
{
this.a = a;
etc....
}
public void ThreadLoop()
{
//Call the method you need or do the action you needed to do :)
//Get the result with your properties
this.Error = this.a.RunCode(player, EcH);
}
}
How to use it ? Simple :)
MyThreadHandle ThreadHandle = new MyThreadHandle(new object()or whatever);
ThreadHandle.SetParam(ObjectA, objectB);
Thread WorkerThread = new Thread(ThreadHandle.ThreadLoop);
WorkerThread.Start();
if (WorkerThread.Join(5000))
{
this.ErrorOutput = ThreadHandle.Error;
}
else
{
this.ErrorOutput = "Time Out, Infinit Loop";
}
--
Saeli Mathieu.
+33 6 45 32 78 47
{Epitech} 2012
Permanent GDL
http://www.gamelab.epitech.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100727/7a2bdf38/attachment.html>
More information about the Ironpython-users
mailing list