I have read Is there an easy way in Python to wait until certain condition is true? and a couple other posts, but I don't think any of them satisfy my specific problem. I apologize if I missed one I just am not sure what to search outside of what I already have.
I have many threads doing some sort of computing. I need them to print in order of creation. My current solution was:
while thread_num != current_print_num:
pass
print(data)
current_print_num += 1
I don't believe this is the most efficient way of going about it. Is there a way to have a thread stop executing for a while after checking the condition I set in the while loop? I understand I can have it sleep, but I would like to not have to set an amount of time for it to wait. Ideally it would awake when current_print_num == thread_num.
A good solution would be to have the threads communicate with each other on when the previous one is finished. Is there a good way to do that?