I’m having trouble wrapping my head around the Threading module.
I wonder what is the best way to stop a thread that is currently running, once some conditions are met.
I managed to achieve this by doing something like:
def threadFunction(): global condition while not condition: do something ... ...
Updating the value of “condition” externally does stop the thread here, but this looks like a horrible solution.
I think I could probably use the Event class or the Condition class (?) but I’m not sure I understand how.
Any help is much appreciated!
Thanks in advance for your time.