[PyQt] QThread, QMutex, windows vs linux

Frédéric Mantegazza frederic.mantegazza at gbiloba.org
Tue Apr 14 09:27:08 BST 2009


> I'm using some threads (QThread) in my app, and I have issues under
> windows, but all works fine on linux.
>
> As I'm accessing some common resources (typically I access the same
> hardware from different threads, through the same bus), I use a QMutex.
> The bus driver, which is common to all threads, as 2 methods:
> acquireBus() and releaseBus(), calling the lock() and unlock() mutex
> methods. Then, in the threads, I call these bus driver methods in a
> try/finally statement. The code is here:
>
>http://trac.gbiloba.org/papywizard/browser/trunk/papywizard/hardware/driverFactory.py
>http://trac.gbiloba.org/papywizard/browser/trunk/papywizard/hardware/abstractDriver.py
>http://trac.gbiloba.org/papywizard/browser/trunk/papywizard/plugins/merlinPlugins.py
>
> My question is: are there some different behaviour between linux and
> windows about QThread and QMutex? Is it better to use a QMutexLocker
> instead of a QMutex? I don't think so, as the try/finally statement
> ensure that the unlock() method is always called...

No idea? Nobody sees big mistakes in my code which can explain it works
on linux but not on Windows?

-- 
    Frédéric



More information about the PyQt mailing list