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

Sampsa Riikonen sampsa.riikonen at iki.fi
Mon Nov 21 20:58:29 GMT 2016


Hi,

I am launching two subclassed QThreads.  In order to share information 
between the two QThreads I do the following:
QThread (1) sends a signal that is connected to a slot of QThread (2)

That signal [QtCore.pyqtSignal(object)] sends a python object having an 
attribute/"sub"-object that is a numpy array occupying a few megabytes 
of data, i.e.:

myobject.buf=numpy.array(....)
signal.emit(myobject)

It works correctly and smoothly .. but I am baffled of what actually 
happens here..

1) If QThread is some sort of subclass of multiprocessing.Process, then 
it should use semaphores and shared memory for these things
2) If QThread is a python thread, then I should be able to see the same 
variables between QThread 1 and 2 but that does not seem to be the case
3) Are they threads executed by the main qt process..?   Then, how does 
the sharing of the object and the underlying numpy array work..?

What is going on under the hood?

Regards,

Sampsa



More information about the PyQt mailing list