吴裕雄 python深度学习与实践(3)

时间:2024-01-06 19:07:38
import threading, time

def doWaiting():
print('start waiting:', time.strftime('%S'))
time.sleep(3)
print('stop waiting', time.strftime('%S'))
thread1 = threading.Thread(target = doWaiting)
thread1.start()
time.sleep(1) #确保线程thread1已经启动
print('start join')
thread1.join() #将一直堵塞,直到thread1运行结束。
print('end join')

吴裕雄 python深度学习与实践(3)