--- a/runtime/PLCObject.py Tue Jul 31 17:46:01 2012 +0200
+++ b/runtime/PLCObject.py Thu Aug 09 20:04:41 2012 +0200
@@ -217,53 +217,53 @@
self.python_threads_vars = None
def PythonThreadProc(self):
- c_argv = ctypes.c_char_p * len(self.argv)
- if self._startPLC(len(self.argv),c_argv(*self.argv)) == 0:
- self.PLCStatus = "Started"
- self.StartSem.release()
- self.evaluator(self.PrepareRuntimePy)
- res,cmd = "None","None"
- #print "_PythonIterator(", res, ")",
- cmd = self._PythonIterator(res)
- res = str(self.evaluator(eval,cmd,self.python_threads_vars))
- res = "#EXCEPTION : "+str(e)
- self.PLCStatus = "Stopped"
- self.evaluator(self.FinishRuntimePy)
- PLCprint("Problem %s PLC"%error)
- self.PLCStatus = "Broken"
- self.StartSem.release()
+ self.PLCStatus = "Started" + self.StartSem.release() + self.evaluator(self.PrepareRuntimePy) + res,cmd = "None","None" + #print "_PythonIterator(", res, ")", + cmd = self._PythonIterator(res) + res = str(self.evaluator(eval,cmd,self.python_threads_vars)) + res = "#EXCEPTION : "+str(e) + self.PLCStatus = "Stopped" + self.evaluator(self.FinishRuntimePy) if self.CurrentPLCFilename is not None and self.PLCStatus == "Stopped":
- self.StartSem=Semaphore(0)
- self.PythonThread = Thread(target=self.PythonThreadProc)
- self.PythonThread.start()
- self.StartSem.acquire()
+ c_argv = ctypes.c_char_p * len(self.argv) + if self._startPLC(len(self.argv),c_argv(*self.argv)) == 0: + self.StartSem=Semaphore(0) + self.PythonThread = Thread(target=self.PythonThreadProc) + self.PythonThread.start() + self.StartSem.acquire() + PLCprint("Problem %s PLC"%error) + self.PLCStatus = "Broken" if self.PLCStatus == "Started":
- self.PLCStatus = "Stopped"
+ self.PythonThread.join()