[PyKDE] Re: Threading problem with PyQt4 and Macosx

Matt Newell newellm at blur.com
Mon Feb 26 19:53:13 GMT 2007


> There are a number of strategies for dealing with this...
>
> 1. Manual inspection of the Qt source code and applying /ReleaseGIL/ where
> needed.
>
> 2. Automatically release the GIL whenever any Qt call is made. This was how
> SIP v3 worked (because it supported earlier versions of Python that didn't
> support PEP 311) and is still available in SIP v4 using the undocumented -g
> flag.
>
> 3. Automatically release the GIL whenever any Qt call is made from a
> QObject derived class. The assumption is that this will cover the vast
> majority of cases. Any other cases would have to be identified through bug
> reports.
>
> 1. is out of the question - unless somebody can recommend a good C++ source
> code analyzer.
>
> I tend towards 3.
>
> Comments?
>
Is there a significant performance cost to releasing the GIL?  If not it seems 
that 3 is a fine solution.  If there is a performance cost then maybe add an 
override /HoldGIL/ annotation or something for certain methods if people need 
the extra performance and the method has been shown to be safe.

Matt




More information about the PyQt mailing list