[PyKDE] Threads and KApplication lock

Russell Valentine russ at coldstonelabs.org
Sun Sep 12 22:52:45 BST 2004


Gordon Tyler said the following on 09/11/04 08:39:
> Russell Valentine wrote:
> 
>> print "DEBUG: doing the lock"
>> self.parentApp.lock()
>> print "DEBUG: lock worked"
>>
>> IE when it locks up I never see "lock worked".
>>
>> I only have one QThread running.
> 
> 
> You mean you have one QThread in addition to the one on which the event 
> queue is processed?

That is correct.

> 
> As far as I recall, during processing of events in the queue, Qt will 
> lock the application. Calling lock() while the app is already locked 
> will block.
> 
> If you haven't already, I would suggest reading the Qt docs on 
> threading: <http://doc.trolltech.com/3.3/threads.html> According to that 
> page, you should only update widgets in the main event thread. To 
> perform GUI updates from other threads, they must post a custom event to 
> the event queue and you should perform the appropriate update in the 
> handler for that custom event.
> 
> Ciao,
> Gordon
> 

This is great, thanks for pointing me in the right direction. I was 
dealing with thread all wrong. It works great, it is now stable!


Russell Valentine
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20040912/7c7900ea/signature.bin


More information about the PyQt mailing list