def _stopHelper(): stopped.wait(10) if stopped.isSet(): return print >>sys.stderr, "Stopping takes long, waiting some more time..." stopped.wait(10) if stopped.isSet(): return print >>sys.stderr, "Ok last chance, killing process in 10 seconds..." stopped.wait(10) if stopped.isSet(): return print >>sys.stderr, "Some threads are still running:" _printStackTraces() print >>sys.stderr, "Killing process..." process.kill(os.getpid(), force=True)
def _stopHelper(): stopped.wait(10) if stopped.isSet() and threading.activeCount() == 1: return print >> sys.stderr, "Stopping takes long, waiting some more time..." stopped.wait(10) if stopped.isSet() and threading.activeCount() == 1: return print >> sys.stderr, "Ok last chance, killing process in 10 seconds..." stopped.wait(10) if stopped.isSet() and threading.activeCount() == 1: return print >> sys.stderr, "Some threads are still running:" _printStackTraces() print >> sys.stderr, "Killing process..." process.kill(os.getpid(), force=True)
def _stopHelper(): stopped.wait(10) if stopped.isSet() and threading.activeCount() == 1: return print >>sys.stderr, "Stopping takes long. Waiting 20 more seconds" stopped.wait(10) if stopped.isSet() and threading.activeCount() == 1: return print >>sys.stderr, "Killing process in 10 seconds..." stopped.wait(10) if stopped.isSet() and threading.activeCount() == 1: return print >>sys.stderr, "Some threads are still running:" _printStackTraces() print >>sys.stderr, "Killing process..." process.kill(os.getpid(), force=True)