--- a/tests/logging/py_ext_0@py_ext/py_ext.xml Wed Mar 13 12:34:55 2013 +0900
+++ b/tests/logging/py_ext_0@py_ext/py_ext.xml Wed Jul 31 10:45:07 2013 +0900
@@ -1,23 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Python xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="py_ext_xsd.xsd">
-<![CDATA[import threading
+<![CDATA[import threading, time
MyT = None
Stop = False
+def StartLog():
+ global MyT
+ MyT=threading.Thread(target = DoLog)
+ MyT.start()
+
def DoLog():
- global MyT,Stop
- MyT=threading.Timer(0.3, DoLog)
- if not Stop : MyT.start()
- Stop = False
- PLCObject.LogMessage("Python side Logging")
+ global Stop
+ while not Stop:
+ PLCObject.LogMessage("Python side Logging (PLC is %s)"%PLCObject.PLCStatus)
+ time.sleep(0.3)
def StopLog():
global MyT,Stop
Stop=True
- if MyT is not None: MyT.cancel()
-_runtime_begin.append(DoLog)
+_runtime_init.append(StartLog)
_runtime_cleanup.append(StopLog)
]]>
</Python>