[PyQt] Global Interpreter Lock

Arnold Krille arnold at arnoldarts.de
Fri Apr 10 19:35:32 BST 2009


On Friday 10 April 2009 20:26:37 Jason Voegele wrote:
> I am a relative newcomer to Python and I don't know much about the Global
> Interpreter Lock (GIL) in general.  However, I am developing a PyQt
> application that makes fairly heavy use of QThread to perform multiple
> tasks concurrently.  I've heard some vague statements that PyQt manages the
> GIL automatically, but can someone give a more precise statement about how
> the GIL works for PyQt applications, especially when QThread is involved? 
> Are there any gotchas that I need to look out for?

Are your QThread-derived threads written in python or in C++? If they are 
python, you hit the same limitation the threading-derived threads hit: Only 
one thread can be executed in the python-interpreter at a time. And even if 
PyQt releases the GIL automaticly, it can't release it if you are executing 
If your threads are C++ classes I think SIP/PyQt will release the GIL so your 
threads will truly run in parallel (assuming you have more then one 

Have fun,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090410/13e3e4c9/attachment-0001.bin

More information about the PyQt mailing list