Paul Rubin wrote:
> Any suggestions for the cleanest way to get rid of the thread?
As Jeff explains, it is rather unlikely that GC will collect
primegen objects, since the generating thread holds self as
a local variable.
You should make background_generator have explicit q and
event arguments, a
I suspect that getting the threads to die will be tricky, and as written
the thread holds a reference to the 'primegen' instance (this part can
be cured, but it still doesn't ever make the thread exit).
Instead of figuring out how to get this to clean itself up, why not make
sure you only make one
You probably have one or more of several problems.
If a __del__ method exists, the object might be stuck in the
gc.garbage list. In general you are better off explicitly stopping it
my adding a method that is called to set your threading.Event.
Likely you will still be stuck waiting on your que