Re: thread vs GC

2005-06-03 Thread =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
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

Re: thread vs GC

2005-06-02 Thread Jeff Epler
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

Re: thread vs GC

2005-06-02 Thread Chris Lambacher
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

thread vs GC

2005-06-02 Thread Paul Rubin
Another of those "how can I kill a thread" questions. Let's say I have an app that needs a random prime number for something every now and then, based on user interaction. I have a function makeprime() which creates such a prime, but it's pretty slow, so I don't want to wait for it when the user