I have a multithreaded program where I create a generator function and then pass it to new threads. I want it to be shared/global in nature so each thread can get the next value from the generator.
Is it safe to use a generator like this, or will I run into problems/conditions accessing the shared generator from multiple threads?
If not, is there a better way to approach the problem? I need something that will cycle through a list and produce the next value for whichever thread calls it.