DebugClients/Python3/DebugBase.py

branch
debugger speed
changeset 5044
630b9f290a77
parent 5041
f00a4c8bcbbd
child 5045
50862a6a2c63
diff -r f00a4c8bcbbd -r 630b9f290a77 DebugClients/Python3/DebugBase.py
--- a/DebugClients/Python3/DebugBase.py	Sun Jul 17 22:40:53 2016 +0200
+++ b/DebugClients/Python3/DebugBase.py	Mon Jul 18 22:12:12 2016 +0200
@@ -13,6 +13,8 @@
 import atexit
 import inspect
 import ctypes
+import _thread
+import time
 from inspect import CO_GENERATOR
 
 from DebugProtocol import ResponseClearWatch, ResponseClearBreak, \
@@ -92,6 +94,18 @@
         
         self.__recursionDepth = -1
         self.setRecursionDepth(inspect.currentframe())
+        
+        # background task to periodicaly check for client interactions
+        self.eventPollFlag = False
+        self.timer = _thread.start_new_thread(self.__eventPollTimer, ())
+
+    def __eventPollTimer(self):
+        """
+        Private method to set a flag every 0.5 s to check for new messages.
+        """
+        while True:
+            time.sleep(0.5)
+            self.eventPollFlag = True
     
     def getCurrentFrame(self):
         """
@@ -246,7 +260,9 @@
             return  # None
         
         # give the client a chance to push through new break points.
-        self._dbgClient.eventPoll()
+        if self.eventPollFlag:
+            self._dbgClient.eventPoll()
+            self.eventPollFlag = False
         
         if event == 'line':
             if self.stop_here(frame) or self.break_here(frame):

eric ide

mercurial