[PyQt] Taking python GIL takes long while running in QT designer

Carl Wolff carl at wolff-online.nl
Tue Dec 6 20:26:52 GMT 2016


Hello,

we use PyQt4 / Python 2.7 in the following use case:

we have python widgets which are integrated in QT designer. Those widgets
have a qtimer which calls a method inside the widgets every 300
milliseconds. The timer and handling code takes care of having 'alive' pyqt
widgets while developing the gui in qt designer. This way we can configure
the widgets using qt designer with some dialogs with live data (while in qt
designer) from a external data source.

Now the following strange thing happen:  we have a extension written in c++
using boost.python which has a thread running which periodically takes the
python interpreter's GIL in order to call a periodic handler in python. The
acquiring of the GIL sometimes takes more than 80 milliseconds, while all
threads are almost idle.

When we run the .ui file using pyqt4.uic.loadUi() we do not have this
problem. Taking the GIL goes instantaneously.

Questions are:
* does qt something with the threads/gil causing the acquiring of the GIL
taking long time?
* Do pyqt4 internals have the GIL acquired for a long time hindering other
threads taking the GIL?

Best regards
Carl.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20161206/197ed7e3/attachment.html>


More information about the PyQt mailing list