1 #!/usr/bin/env python 2 import threading 3 # event.wait()##阻断线程向下执行 event_obj.set()#释放进程向下执行 4 def do(event): 5 print('start') 6 event.wait()##阻断线程向下执行 7 print('execute') 8 9 event_obj = threading.Event() 10 for i in range(10): 11 t = threading.Thread(target=do, args=(event_obj,)) 12 t.start() 13 event_obj.clear() 14 inp = input('input:') 15 if inp == 'true': 16 event_obj.set()#释放线程向下执行