[PyKDE] Singleshot problems in QThreads on Windows.

Truls A. Tangstad kerfue+pykde at herocamp.org
Fri Aug 20 16:32:21 BST 2004

On Fri, Aug 20, 2004 at 04:23:09PM +0100, Toby Dickenson wrote:
> On Friday 20 August 2004 15:47, Truls A. Tangstad wrote:
> > .....a postEvent-bug which we cannot reproduce yet in a small example.
> I dont think youve posted about that one so far. In what way is postEvent not 
> working?

I haven't posted it yet because we haven't been able to isolate it.
AFAIK, that the application hangs in postEvent might just be a symptom
of something else not willing to release a lock.

> > So, what I'm wondering, is if there's a way to update the GUI with
> > state created by the worker-threads without using postEvent or QTimer
> > in the worker-threads? There must be some way to trigger calls in the
> > GUI-thread without these.
> My workaround seems to be working well for us, with non-QThread worker 
> threads:
> http://mats.imk.fraunhofer.de/pipermail/pykde/2004-August/008364.html

As I mentioned, we did something similar, using Queue, but with
QTimer.singleShot instead of postEvent, which then makes the
GUI-thread read from the queue. Problem was now that postEvent might
be the source of some hangs and QTimer.singleShot isn't working from
other threads in windows.

I'm currently testing an implementation where our own eventsystem uses
a QTimer created in the GUI-thread to poll every 100 ms for events
added to the thread-safe queue. If this works we might atleast get a
new version of our software released over the weekend before isolating
the problems with postEvent.

Truls A. Tangstad - <kerfue+pykde at h e r o c a m p.org>

More information about the PyQt mailing list