I have what might be a quite simple problem, but I still cannot solve it.
I have the following code:
list_of_conditions = []
def function_1():
time.sleep(60)
global list_of_conditions
condition=list_of_conditions.pop()
condition.notify()
print("F1: Done")
def function_2():
condition = Condition()
global list_of_conditions
list_of_conditions.append(condition)
with condition:
p1=Process(target=function_1, daemon=True)
p1.start()
condition.wait()
print("Finished")
I think it is quite clear what I want to accomplish with the condition, but I have the problem that the global array is not working. I keep getting the error message:
IndexError: pop from empty list
I dont get it why the list is empty even though I have declare it as global.