Commented out safety check to prevent deadlock in wxEvaluator, since wx Mainloop is not anymore in main thread. That safety check actually leads to having wx code running outside of MainLoop
authorEdouard Tisserant
Mon, 04 Jun 2018 11:22:08 +0200
changeset 2018 983c482f8e42
parent 2011 64268e87613e
child 2019 92f02bb17c7e
Commented out safety check to prevent deadlock in wxEvaluator, since wx Mainloop is not anymore in main thread. That safety check actually leads to having wx code running outside of MainLoop
Beremiz_service.py
--- a/Beremiz_service.py	Wed May 23 10:53:57 2018 +0200
+++ b/Beremiz_service.py	Mon Jun 04 11:22:08 2018 +0200
@@ -510,7 +510,7 @@
 
 if havewx:
     wx_eval_lock = Semaphore(0)
-    main_thread = currentThread()
+    # main_thread = currentThread()
 
     def statuschangeTskBar(status):
         wx.CallAfter(taskbar_instance.UpdateIcon, status)
@@ -523,14 +523,14 @@
         wx_eval_lock.release()
 
     def evaluator(tocall, *args, **kwargs):
-        if main_thread == currentThread():
-            # avoid dead lock if called from the wx mainloop
-            return default_evaluator(tocall, *args, **kwargs)
-        else:
-            o = type('', (object,), dict(call=(tocall, args, kwargs), res=None))
-            wx.CallAfter(wx_evaluator, o)
-            wx_eval_lock.acquire()
-            return o.res
+        # if main_thread == currentThread():
+        #     # avoid dead lock if called from the wx mainloop
+        #     return default_evaluator(tocall, *args, **kwargs)
+        # else:
+        o = type('', (object,), dict(call=(tocall, args, kwargs), res=None))
+        wx.CallAfter(wx_evaluator, o)
+        wx_eval_lock.acquire()
+        return o.res
 
     pyroserver = Server(servicename, given_ip, port,
                         WorkingDir, argv,