svghmi/svghmi_server.py
changeset 4003 65aae40f81dd
parent 3864 3e434edfbfdf
child 4004 19f8192b7d68
equal deleted inserted replaced
4002:6c2b80b4515d 4003:65aae40f81dd
   308     if proc is None:
   308     if proc is None:
   309         return
   309         return
   310     def waitpid_timeout_loop(proc = proc, timeout = timeout):
   310     def waitpid_timeout_loop(proc = proc, timeout = timeout):
   311         try:
   311         try:
   312             while proc.poll() is None:
   312             while proc.poll() is None:
   313                 time.sleep(1)
   313                 time.sleep(.1)
   314                 timeout = timeout - 1
   314                 timeout = timeout - .1
   315                 if not timeout:
   315                 if timeout <= 0:
   316                     GetPLCObjectSingleton().LogMessage(
   316                     GetPLCObjectSingleton().LogMessage(
   317                         LogLevelsDict["WARNING"], 
   317                         LogLevelsDict["WARNING"], 
   318                         "Timeout waiting for {} PID: {}".format(helpstr, str(proc.pid)))
   318                         "Timeout waiting for {} PID: {}".format(helpstr, str(proc.pid)))
   319                     break
   319                     break
   320         except OSError:
   320         except OSError:
   321             # workaround exception "OSError: [Errno 10] No child processes"
   321             # workaround exception "OSError: [Errno 10] No child processes"
   322             pass
   322             pass
   323     Thread(target=waitpid_timeout_loop, name="Zombie hunter").start()
   323     waitpid_timeout_loop()
   324 
   324