[PyKDE] Multithreaded GUI programming

Gordon Tyler gordon at doxxx.net
Sat Dec 7 01:43:09 GMT 2002


On December 6, 2002 11:50 am, Michael Lauer wrote:
> Our setup is a typical multithreaded one: We have a number of worker
> threads and one GUI thread,
> both communicating via a Queue. The problem is: How not to waste CPU
> resources by using a timer
> to poll the communication Queue from within the GUI thread.

I don't imagine that the polling is going to be particularly expensive but 
I've never measured it. Have you?

> Qt/E 2.3.4
> is _not_ thread-safe, so all calls to Qt must be done from same thread.
> This also means,
> it's unfortunately not possible to call QApplication.postEvent() from a
> worker thread
> to make the GUI thread to check for a new message in the Queue.

Are you not able to use QApplication.lock() and unlock() around the postEvent?

Ciao,
Gordon




More information about the PyQt mailing list