etherlab/runtime_etherlab.py
changeset 2404 87eb184414bd
parent 2401 fe887446134d
child 2405 af050469fc5c
equal deleted inserted replaced
2403:045df8ecc8b3 2404:87eb184414bd
     1 import os
     1 import os
       
     2 import signal
     2 import subprocess
     3 import subprocess
     3 import ctypes
     4 import ctypes
     4 from threading import Thread
     5 from threading import Thread
     5 import time
     6 import time
     6 import re
     7 import re
       
     8 
       
     9 import runtime.PLCObject as PLCObject
     7 from runtime.loglevels import LogLevelsDict
    10 from runtime.loglevels import LogLevelsDict
     8 
    11 
     9 SDOAnswered = PLCBinary.SDOAnswered
    12 SDOAnswered = PLCBinary.SDOAnswered
    10 SDOAnswered.restype = None
    13 SDOAnswered.restype = None
    11 SDOAnswered.argtypes = []
    14 SDOAnswered.argtypes = []
   109 
   112 
   110 
   113 
   111 def _runtime_etherlab_cleanup():
   114 def _runtime_etherlab_cleanup():
   112     global KMSGPollThread, StopKMSGThread, SDOProc, SDOThread
   115     global KMSGPollThread, StopKMSGThread, SDOProc, SDOThread
   113     try:
   116     try:
   114         os.kill(SDOProc.pid, SIGTERM)
   117         os.kill(SDOProc.pid, signal.SIGTERM)
   115     except Exception:
   118     except Exception:
   116         pass
   119         pass
   117     SDOThread = None
   120     SDOThread = None
   118     StopKMSGThread = True
   121     StopKMSGThread = True
   119     KMSGPollThread = None
   122     KMSGPollThread = None