runtime/PLCObject.py
changeset 2606 9944a18cad17
parent 2602 19dc6b830e7d
child 2608 a332f989f0b8
--- a/runtime/PLCObject.py	Tue Apr 16 14:45:41 2019 +0200
+++ b/runtime/PLCObject.py	Thu Apr 18 14:42:23 2019 +0200
@@ -388,7 +388,7 @@
         self.PythonThreadCondLock = Lock()
         self.PythonThreadCond = Condition(self.PythonThreadCondLock)
         self.PythonThreadCmd = "Wait"
-        self.PythonThread = Thread(target=self.PythonThreadProc)
+        self.PythonThread = Thread(target=self.PythonThreadProc, name="PLCPythonThread")
         self.PythonThread.start()
 
     # used internaly
@@ -477,8 +477,14 @@
             return True
         return False
 
-    @RunInMain
     def GetPLCstatus(self):
+        try:
+            return self._GetPLCstatus()
+        except EOFError:
+            return (PlcStatus.Disconnected, None)
+
+    @RunInMain
+    def _GetPLCstatus(self):
         return self.PLCStatus, map(self.GetLogCount, xrange(LogLevelsCount))
 
     @RunInMain
@@ -645,7 +651,7 @@
     def _TracesSwap(self):
         self.LastSwapTrace = time()
         if self.TraceThread is None and self.PLCStatus == PlcStatus.Started:
-            self.TraceThread = Thread(target=self.TraceThreadProc)
+            self.TraceThread = Thread(target=self.TraceThreadProc, name="PLCTrace")
             self.TraceThread.start()
         self.TraceLock.acquire()
         Traces = self.Traces