[PyQt] QThread, QMutex, windows vs linux

Frédéric frederic.mantegazza at gbiloba.org
Sun Apr 12 19:25:43 BST 2009


Hello,

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...

-- 
    Frédéric

    http://www.gbiloba.org



More information about the PyQt mailing list