[PyQt] Help with unresponsive GUI
eric.frederich at gmail.com
Tue Aug 30 18:34:59 BST 2011
Bringing this topic back to the mailing list.
I wish gmail had a more prominent "reply to all" button so I wouldn't
inadvertently bring stuff offline.
Problem solved....GIL is the problem.
Cython made it somewhat simple to test especially since my Cython
bindings are generated and not hand made.
On each of my .pxd files I added nogil to the "cdef extern from "foo.h" lines.
cdef extern from "foo.h" nogil:
int bar(char* x, int* y)
And then each of my function calls in the .pyx files I put inside a
def bar(char* x):
After doing this my GUI is more responsive than ever.
This is my first gripe with the GIL and I have done used the
multiprocessing module before with work queues.
Thanks for the help.
On Tue, Aug 30, 2011 at 11:26 AM, Eric Frederich
<eric.frederich at gmail.com> wrote:
> From what I can tell, the worker thread is not eating resources.
> This particular system has 12 cores and 24GB of RAM.
> Other GUI's on the same system are very responsive.
> Perhaps it is a GIL issue.
> I created Cython bindings to a 3rd party lib.
> In my bindings I do nothing with the GIL.
> I just happened to look at this....
> I will try to release and re-acquire in my bindings and see if this
> fixes things.
> On Tue, Aug 30, 2011 at 11:07 AM, Erik Janssens
> <Erik.Janssens at conceptive.be> wrote:
>> when calling time.sleep, all resources are given explicitly
>> to the other threads.
>> two things might go wrong :
>> - the worker thread is eating all resources of the machine
>> - the worker thread keeps the GIL locked for a very long
>> time (maybe a third party lib that does not release the
>> GIL properly)
>> On Tue, 2011-08-30 at 10:47 -0400, Eric Frederich wrote:
>>> Hello all,
>>> I am having problems with an unresponsive GUI.
>>> I have a GUI for a client in a client / server program.
>>> For long running operations, I implemented a QThread subclass and do
>>> everything in the run method.
>>> Still, I have an unresponsive GUI.
>>> If I replace all the the server calls with a time.sleep, its still a
>>> long running process but the GUI is responsive..amount_to_deduce
>>> Why would server calls in a separate thread be different from sleep
>>> calls in a separate thread?
>>> Perhaps I am setting this up entirely wrong.... this is how I have
>>> things hooked up.
>>> The GUI Thread, when a button is pressed creates an instance of this
>>> QThread subclass.
>>> It connects the QThread subclass's finished signal to a slot called update_list.
>>> It then calls the start method.
>>> The QThread subclass traverses a big structure and stores results in
>>> an instance variable called data.
>>> So, when the thread is finished, the update_list slot is called and in
>>> there it gets results via self.sender().data
>>> If I'm doing something completely boneheaded, let me know.
>>> PyQt mailing list PyQt at riverbankcomputing.com
More information about the PyQt