eric6/DebugClients/Python/ThreadExtension.py

branch
multi_processing
changeset 7417
9391a330f50f
parent 7416
6f899e82f9a2
child 7419
9c1163735448
diff -r 6f899e82f9a2 -r 9391a330f50f eric6/DebugClients/Python/ThreadExtension.py
--- a/eric6/DebugClients/Python/ThreadExtension.py	Sat Feb 15 14:33:13 2020 +0100
+++ b/eric6/DebugClients/Python/ThreadExtension.py	Sat Feb 15 15:59:24 2020 +0100
@@ -149,30 +149,23 @@
         Public method to send the list of threads.
         """
         self.updateThreadList()
+        
         threadList = []
-        if len(self.threads) > 1:
-            currentId = _thread.get_ident()
-            # update thread names set by user (threading.setName)
-            threadNames = {t.ident: t.getName() for t in threading.enumerate()}
+        currentId = _thread.get_ident()
+        # update thread names set by user (threading.setName)
+        threadNames = {t.ident: t.getName() for t in threading.enumerate()}
+        
+        for threadId, thd in self.threads.items():
+            d = {"id": threadId}
+            try:
+                d["name"] = threadNames.get(threadId, thd.name)
+                d["broken"] = thd.isBroken
+                d["except"] = thd.isException
+            except Exception:
+                d["name"] = 'UnknownThread'
+                d["broken"] = False
+                d["except"] = False
             
-            for threadId, thd in self.threads.items():
-                d = {"id": threadId}
-                try:
-                    d["name"] = threadNames.get(threadId, thd.name)
-                    d["broken"] = thd.isBroken
-                    d["except"] = thd.isException
-                except Exception:
-                    d["name"] = 'UnknownThread'
-                    d["broken"] = False
-                    d["except"] = False
-                
-                threadList.append(d)
-        else:
-            currentId = -1
-            d = {"id": -1}
-            d["name"] = "MainThread"
-            d["broken"] = self.isBroken
-            d["except"] = self.isException
             threadList.append(d)
         
         self.sendJsonCommand("ResponseThreadList", {

eric ide

mercurial