Enure that autostart blocks other @RunInMain PLCObject methods, and _unblocks_ them once autostart is done...
authorEdouard Tisserant
Wed, 05 Dec 2018 13:05:51 +0100
changeset 2467 fce6ab7ae156
parent 2466 98d28d809488
child 2468 046303391dea
Enure that autostart blocks other @RunInMain PLCObject methods, and _unblocks_ them once autostart is done...
runtime/Worker.py
--- a/runtime/Worker.py	Wed Dec 05 13:04:37 2018 +0100
+++ b/runtime/Worker.py	Wed Dec 05 13:05:51 2018 +0100
@@ -56,6 +56,7 @@
         meant to be called by worker thread (blocking)
         """
         self._threadID = thread.get_ident()
+        self.mutex.acquire()
         if args or kwargs:
             _job = job(*args, **kwargs)
             _job.do()
@@ -64,7 +65,6 @@
                 pass
             else:
                 raise _job.exc_info[0], _job.exc_info[1], _job.exc_info[2]
-        self.mutex.acquire()
         while not self._finish:
             self.todo.wait()
             if self.job is not None: