importthreading
importtime
defdo(event):
print('start')
time.sleep(1)
event.set()
print('event set')
event_obj = threading.Event()
t = threading.Thread(target=do,args=(event_obj,))
t.start()
print("no event result")
event_obj.wait()
# for i in range(10):
print("event result")
网友评论