Document

Python多线程并发运行

import threading

mutex_lock = threading.RLock()
class Threads(threading.Thread):
    def __init__(self,name):
        threading.Thread.__init__(self)

    def run(self):
        global mutex_lock
        print("多线程并行运行")

threads = []
for i in range(10):
    thread = Threads(i)
    threads.append(thread)
for t in threads:
    t.start()
for t in threads:
    t.join()
posted @ 2022-02-25 15:36  lsepi  阅读(246)  评论(0编辑  收藏  举报