澄梦希喜广告网站制作遂宁站

threadingjoin方法

threading的join方式使用实例代码

import time
import threading

def foo(n):
    for i in range(n):
        print(i)
        time.sleep(1)

t_list = []

for _ in range(2):
    t = threading.Thread(target=foo, args=(10, ), daemon=True)
    t_list.append(t)
    t.start()

for i in t_list:
    i.join()

print('Main Tread Exiting')

当前名称:threadingjoin方法
标题网址:http://hfanp.com/article/gghedi.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部