[PyKDE] Threads & PyQt 3?

Phil Thompson phil at river-bank.demon.co.uk
Sun Feb 24 20:06:29 GMT 2002


gvermeul at polycnrs-gre.fr wrote:
> 
> > Gerard Vermeulen wrote:
> > >
> > > Great Phil,
> > >
> > > but I really think that adding the Py_BEGIN_ALLOW_THREADS and
> > > Py_END_ALLOW_THREADS to the wrappers may really help to run threads
> > > more smoothly, in case that the wrapped functions ask a lot of CPU time
> > > or require I/O.
> >
> > Currently this is done (via sipReleaseLock() and sipAcquireLock()) for
> > calls that handle Qt events (eg. QApplication.exec_loop()). There
> > shouldn't be any problem with adding calls to things like
> > QFile.readBlock() etc. Or are you suggesting adding them for every
> > single Qt call?
> >
> I did not realize that these macros were already handled via those
> ..Lock() functions. I did just a few tests and to my surprise
> multithreading worked better than I expected.
> 
> Yes, I was thinking to adding them to every Qt call. Of course that
> is a naive brute force approach. It should be better to add
> a sip directive, allowing thread switching in the Qt calls that
> may demand a lot of time.

The directive is /ReleaseLock/. I'll add it to all the read/write
methods I can find.

Phil




More information about the PyQt mailing list