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/
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com