protected static void Thread_1_Handle() { State_1 = ScriptThreadState.Waiting; while (true) { //Warte bis ein object an den Thread übergeben wird while (Thread_1_Obj == null) Thread.Sleep(1); State_1 = ScriptThreadState.Running; Function local = null; lock (Thread_1_Obj) { local = Thread_1_Obj; } Thread_1_LocalNode = local.GetFunctionNode(new List<Node>(), true); Thread_1_LocalNode.ScriptThreadID = 1; bool b = false; try { Thread_1_LocalNode.Evaluate(out b); } catch(Exception ex) { if (ex.GetType() == typeof(ParserException)) { Console.WriteLine(ex.Message); if (Thread_1_ParserException != null) { Thread_1_ParserException( (ParserException) ex); } Thread_1_ParserException -= Thread_1_ParserException; } } Thread_1_LocalNode.Clean(); local.Clear(); lock (Thread_1_Obj) { Thread_1_Obj = null; } State_1 = ScriptThreadState.Waiting; //Warte am ende 1ms Thread.Sleep(1); } }