在这些场景中是否Event
做同样的事情?Lock
class MyThread1(threading.Thread):
def __init__(event):
self.event = event
def run(self):
self.event.wait()
# do something
self.event.clear()
其他:
class MyThread2(threading.Thread):
def __init__(lock):
self.lock = lock
def run(self):
self.lock.acquire()
# do something
self.lock.release()