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()