should_go = False
cv = Condition()
while True:
with cv:
if not should_go:
cv.wait()
if should_go:
# process_time_cost_tasks()
should_go = False
def request():
with cv:
should_go = True
cv.notify()
Question: Does it matter if I possess the lock during the task processing time(quite long)?