Named runtime's threads to ease debugging
authorEdouard Tisserant
Wed, 17 Apr 2019 14:18:22 +0200
changeset 2600 0e20a0d48fae
parent 2599 b4649f014a39
child 2601 9c5b20dc2b2e
Named runtime's threads to ease debugging
Beremiz_service.py
runtime/PLCObject.py
--- a/Beremiz_service.py	Wed Apr 17 14:15:39 2019 +0200
+++ b/Beremiz_service.py	Wed Apr 17 14:18:22 2019 +0200
@@ -532,7 +532,8 @@
 pyro_thread_started = Lock()
 pyro_thread_started.acquire()
 pyro_thread = Thread(target=pyroserver.PyroLoop,
-                     kwargs=dict(when_ready=pyro_thread_started.release))
+                     kwargs=dict(when_ready=pyro_thread_started.release),
+                     name="PyroThread")
 pyro_thread.start()
 
 # Wait for pyro thread to be effective
@@ -557,7 +558,7 @@
     else:
         ui_thread_target = app.MainLoop
 
-    ui_thread = Thread(target=ui_thread_target)
+    ui_thread = Thread(target=ui_thread_target, name="UIThread")
     ui_thread.start()
 
     # This order ui loop to unblock main thread when ready.
--- a/runtime/PLCObject.py	Wed Apr 17 14:15:39 2019 +0200
+++ b/runtime/PLCObject.py	Wed Apr 17 14:18:22 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
@@ -645,7 +645,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