[PyKDE] Re: Threading problem with PyQt4 and Macosx

Phil Thompson phil at riverbankcomputing.co.uk
Thu Feb 22 11:16:25 GMT 2007


> I recently started playing around with QThreads and Events/emits in  
> pyqt4 (latest version) and I am facing some serious problems (hangs)  
> now.
> I tried to keep the attached test very small.
> I have a textedit field that gets filed by QThreads.
> What happens is that if more threads get added while the program is  
> running it just locks (happens between 30-50 threads). I have to kill  
> -9 it.
> This happens faster when removing threads. I had someone test this on  
> an ubuntu machine and he did not see the problem but I am still not  
> sure if this is a macosx only problem.
> I tried events as well and it locks up faster (less threads) with them.
> Am I doing something fundamentaly wrong here?

I tried this on Linux with current SIP and PyQt4 snapshots. I was able to run 
175 threads without problems - CPU was at 93%. 180 threads (CPU at 98%) 
caused it to slow dramatically and then hang - not unreasonable behaviour I 
think. (The only potential issue is that memory usage increased slowly, even 
though the number of threads was constant.)

There have been changes in this area in the past few days, so maybe it's been 
fixed. If you want to try the current snapshots you will have to apply the 
following fix (which will be in tonight's snapshot)...

In qobject.sip add the following line to the public section of QObject:

    const QMetaObject *metaObject() const;

Phil




More information about the PyQt mailing list