首页 > 编程语言 > 详细

缩减版多线程

时间:2019-11-22 16:28:46      阅读:68      评论:0      收藏:0      [点我收藏+]
import threading
lock = threading.Lock()

def th_001(req):
lock.acquire()
print(req,time.asctime())
lock.release()

def test():
pool=[]
for i in range(1000):
th=threading.Thread(target=th_001,args=(i,))
th.start()
pool.append(th)
for t in pool:
t.join()


if __name__ == ‘__main__‘:

test()

缩减版多线程

原文:https://www.cnblogs.com/SunshineKimi/p/11912235.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!