threadingstart()和run()的区别

threading Tread run() 和 start()区别

import threading
import time

def worker():
    count = 0
    while True:
        if count > 5:
            break
        time.sleep(1)
        count += 1
        print('worker running and threading_name={}'.format(
            threading.current_thread().name))

class MyThread(threading.Thread):
    def start(self):
        print('start-------')
        super().start()

    def run(self):
        print('run------')
        super().run()

t = MyThread(name='worker',target=worker)
# t.start()
t.run()

分享名称:threadingstart()和run()的区别
网页地址:http://lszwz.com/article/poeceg.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款