[PyQt] Mixture of C++/Python and threading

Martin Dobias wonder.sk at gmail.com
Thu Feb 10 22:05:30 GMT 2011


On Wed, Feb 9, 2011 at 5:24 PM, Giovanni Bajo <rasky at develer.com> wrote:
>
> Which version of PyQt4/sip are you using? In recent PyQt versions, GIL
> is always released when entering Qt.

You're right, I have finally come up with a better solution than those
I have anticipated. After initialization of embedded python in the
application I release GIL (with PyEval_SaveThread) and properly wrap
all calls to python API with PyGILState_Ensure and PyGILState_Release.
As a result most of the time no thread holds GIL - so any thread can
access python interpreter without getting stuck.

Regards
Martin


More information about the PyQt mailing list