import time from threading import Thread def func1(): while True: print(‘*‘*10) time.sleep(1) def func2(): print(‘in func2‘) time.sleep(5) t = Thread(target=func1,) t.daemon = True t.start() t2 = Thread(target=func2,) t2.start() # t2.join() print(‘主线程‘)
import time from threading import Thread,Lock def func(): print(666) time.sleep(10) def func2(): pass t = Thread(target=func) t.daemon = True t.start() print(‘主线程‘)
原文:https://www.cnblogs.com/kuraki/p/9617319.html