# __author: "ZXYang"
# date: 2020/5/13
import threading
class MyThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
# self.num = num
def s(self):
lock.acquire()
print('aaa')
lock.acquire()
print('bbb')
lock.release()
lock.release()
def t(self):
lock.acquire()
print('aaa')
lock.acquire()
print('bbb')
lock.release()
lock.release()
def run(self):
self.s()
self.t()
if __name__ == '__main__':
lock = threading.RLock()
threads = []
for i in range(10):
threads.append(MyThread())
for t in threads:
t.start()