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‘)
原文地址:https://www.cnblogs.com/tszr/p/10352674.html
时间: 2024-11-06 09:38:51