[PyQt] Is QThread a (multi)process or a thread?

Kyle Altendorf sda at fstab.net
Mon Nov 21 22:46:08 GMT 2016



On 2016-11-21 15:58, Sampsa Riikonen wrote:
> I am launching two subclassed QThreads.

My understanding is that subclassing QThread is rarely the correct thing 
to do.  Is there something wrong with the stock implementation of a 
QThread that you need to override?  Rather, you are supposed to create a 
stock QThread and also some other QObject-inheriting class with your 
logic that you then move to the QThread.  This let's that QObject run 
via the other thread's event loop.

But like Phil pointed out, multithreading doesn't increase your 
available CPU time due to the Python GIL.  It's only helpful for I/O 
bound tasks and even then the Python community, in my experience, 
prefers solutions other than threads (async/twisted/...).

Cheers,
-kyle


More information about the PyQt mailing list