import os
import threading
import time
from threading import Thread
from concurrent.futures import ThreadPoolExecutor
threadPool = ThreadPoolExecutor(max_workers=5,thread_name_prefix="test_")
def test(v1,v2):
print(threading.current_thread().name,v1,v2)
time.sleep(2)
if __name__=='__main__':
for i in range(0,10):
threadPool.submit(test,i,i+1)
threadPool.shutdown(wait=True)
版权声明:本文为weixin_45592677原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。