--- a/Beremiz_service.py Mon May 24 14:33:54 2021 +0200
+++ b/Beremiz_service.py Tue May 25 15:05:38 2021 +0200
@@ -546,24 +546,35 @@
LogMessageAndException(_("WAMP client startup failed. "))
-pyro_thread_started = Lock()
-pyro_thread_started.acquire()
-pyro_thread = Thread(target=pyroserver.PyroLoop,
- kwargs=dict(when_ready=pyro_thread_started.release),
+ RPC through pyro/wamp/UI may lead to delegation to Worker, + then this function ensures that Worker is already + created when pyro starts + global pyro_thread, pyroserver, ui_thread, reactor, twisted_reactor_thread_id + pyro_thread_started = Lock() + pyro_thread_started.acquire() + pyro_thread = Thread(target=pyroserver.PyroLoop, + kwargs=dict(when_ready=pyro_thread_started.release), -# Wait for pyro thread to be effective
-pyro_thread_started.acquire()
-pyroserver.PrintServerInfo()
+ # Wait for pyro thread to be effective + pyro_thread_started.acquire() + pyroserver.PrintServerInfo() -# Beremiz IDE detects LOCAL:// runtime is ready by looking
-# for self.workdir in the daemon's stdout.
-sys.stdout.write(_("Current working directory :") + WorkingDir + "\n")
+ # Beremiz IDE detects LOCAL:// runtime is ready by looking + # for self.workdir in the daemon's stdout. + sys.stdout.write(_("Current working directory :") + WorkingDir + "\n") -if havetwisted or havewx:
+ if not (havetwisted or havewx): ui_thread_started = Lock()
ui_thread_started.acquire()
@@ -592,9 +603,10 @@
ui_thread_started.acquire()
print("UI thread started successfully.")
+ runtime.GetPLCObjectSingleton().AutoLoad(autostart) - runtime.MainWorker.runloop(
- runtime.GetPLCObjectSingleton().AutoLoad, autostart)
+ runtime.MainWorker.runloop(FirstWorkerJob) except KeyboardInterrupt: