Does Event
and Lock
do the same thing in these scenes?
class MyThread1(threading.Thread):
def __init__(event):
self.event = event
def run(self):
self.event.wait()
# do something
self.event.clear()
another:
class MyThread2(threading.Thread):
def __init__(lock):
self.lock = lock
def run(self):
self.lock.acquire()
# do something
self.lock.release()