refine manyuser thread start & stop

This commit is contained in:
BreakWa11 2015-12-28 15:05:47 +08:00
parent 876bbbe5d8
commit 90ae1fdc40
3 changed files with 46 additions and 15 deletions

View file

@ -39,15 +39,23 @@ class MainThread(threading.Thread):
def run(self):
db_transfer.DbTransfer.thread_db()
def stop(self):
db_transfer.DbTransfer.thread_db_stop()
def main():
shell.check_python()
if True:
if False:
db_transfer.DbTransfer.thread_db()
else:
thread = MainThread()
thread.start()
while True:
time.sleep(99999)
try:
while True:
time.sleep(99999)
except (KeyboardInterrupt, IOError, OSError) as e:
import traceback
traceback.print_exc()
thread.stop()
if __name__ == '__main__':
main()