# HG changeset patch # User Edouard Tisserant # Date 1327886343 -3600 # Node ID f97f207d027b4177904b7aa0f10fd4764c3a8e61 # Parent fb03cb6da95c1c15adf1680bf0da7fbdc06fbf27 temporary fix for debugger crash in case of high sampling rates diff -r fb03cb6da95c -r f97f207d027b plugger.py --- a/plugger.py Wed Jan 25 01:23:44 2012 +0100 +++ b/plugger.py Mon Jan 30 02:19:03 2012 +0100 @@ -775,6 +775,7 @@ # Setup debug information self.IECdebug_datas = {} + self.IECdebug_display_lock = Semaphore(1) self.IECdebug_lock = Lock() self.DebugTimer=None @@ -1772,6 +1773,13 @@ def GetTicktime(self): return self._Ticktime + def DebugDispatch(self, TracedDebugVars, debug_tick): + for IECPath,value in TracedDebugVars: + if value is not None: + self.CallWeakcallables(IECPath, "NewValue", debug_tick, value) + self.CallWeakcallables("__tick__", "NewDataAvailable") + self.IECdebug_display_lock.release() + def DebugThreadProc(self): """ This thread waid PLC debug data, and dispatch them to subscribers @@ -1789,10 +1797,8 @@ wx.CallAfter(self.logger.write, _("... debugger recovered\n")) debug_getvar_retry = 0 - for IECPath,value in zip(self.TracedIECPath, debug_vars): - if value is not None: - self.CallWeakcallables(IECPath, "NewValue", debug_tick, value) - self.CallWeakcallables("__tick__", "NewDataAvailable") + if self.IECdebug_display_lock.acquire(False): + wx.CallAfter(self.DebugDispatch, zip(self.TracedIECPath, debug_vars), debug_tick) self.IECdebug_lock.release() if debug_getvar_retry == DEBUG_RETRIES_WARN: wx.CallAfter(self.logger.write,