import threading import time import random # threading.Thread(target=None, args=()) def hello(): time.sleep(random.random()) print("hello world %d" % threading.active_count()) arr = [] def wait(): for x in arr: x.join() print("所有程序执行完毕") # hello() for x in range(10): t = threading.Thread(target=hello) t.start() arr.append(t) threading.Thread(target=wait).start() print("没有阻塞") # 没有阻塞
python多线程调用规范
最新推荐文章于 2023-06-25 09:57:21 发布