[pygtk] More Help: Problems with the solution to: threads and pygtk

David Hirschfield davidh at ilm.com
Sat Oct 7 02:43:06 WST 2006


It appears to.
I still don't like it one little bit.

Placing the gc.disable() just before my thread code starts to do 
anything, and the gc.enable() right after it finishes solves the 
freezing problem.
Of course, I assume that means that cyclic garbage collection is turned 
off for all threads that run between the time I call gc.disable() and 
gc.enable(), not just the processing thread.

When I get a chance I'll have to make a test case that exhibits this 
problem clearly so someone can look at it carefully and figure out why 
it's an issue.
-David

Stephen Langer wrote:
>
> On Oct 5, 2006, at 5:30 PM, David Hirschfield wrote:
>
>> Here's the issue now: I don't know much about how the garbage 
>> collector works in python, and in order to get the thread to run 
>> without freezing, I'm wrapping the threaded processing function with 
>> calls to gc.disable()/gc.enable().
>
> Will that work?  Does calling gc.disable() on a thread disable garbage 
> collection for all threads, or only for the calling thread?  I suspect 
> that what you want to do is to call gc.disable() once, and then call 
> gc.collect() explicitly on the main thread (or whichever thread is 
> handling gtk).
>
>  -- Steve
>
> -- 
> -- EMail: stephen.langer at nist.gov                    Phone: (301) 
> 975-5423 --
> -- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/    Fax:   (301) 
> 975-3553 --
> -- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, Md  
> 20899-8910 --
>
> -- "I don't think this will work.  That's why it's 
> science."               --
> --                              Naomi Langer (age 6),  17 Feb 
> 2003         --
>
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>

-- 
Presenting:
mediocre nebula.



More information about the pygtk mailing list