Runtime now unloads and cleanup PLC before exit (created threads was preventing exit)
--- a/Beremiz_service.py Fri Apr 19 01:44:25 2013 +0200
+++ b/Beremiz_service.py Fri Apr 19 11:19:55 2013 +0900
@@ -465,6 +465,8 @@
def Quit(self):
self.continueloop = False
+ if self.plcobj is not None:
+ self.plcobj.UnLoadPLC()
self.Stop()
def Start(self):
@@ -496,7 +498,8 @@
self.daemon.requestLoop()
def Stop(self):
- self.plcobj.StopPLC()
+ if self.plcobj is not None:
+ self.plcobj.StopPLC()
if self.servicepublisher is not None:
self.servicepublisher.UnRegisterService()
self.servicepublisher = None
--- a/runtime/PLCObject.py Fri Apr 19 01:44:25 2013 +0200
+++ b/runtime/PLCObject.py Fri Apr 19 11:19:55 2013 +0900
@@ -205,6 +205,10 @@
PLCprint(self._loading_error)
return False
+ def UnLoadPLC(self):
+ self.PythonRuntimeCleanup()
+ self._FreePLC()
+
def _FreePLC(self):
"""
Unload PLC library.
@@ -363,9 +367,8 @@
NewFileName = md5sum + lib_ext
extra_files_log = os.path.join(self.workingdir,"extra_files.txt")
- self.PythonRuntimeCleanup()
-
- self._FreePLC()
+ self.UnLoadPLC()
+
self.LogMessage("NewPLC (%s)"%md5sum)
self.PLCStatus = "Empty"