[Interest] Using QNAM from threads

Thiago Macieira thiago.macieira at intel.com
Wed Jan 29 19:22:00 CET 2014


On quarta-feira, 29 de janeiro de 2014 18:24:10, Konrad Rosenbaum wrote:
> > But it seems to be impossible to connect a slot from a thread to a signal
> > of the QNAM created QNetworkReply object.
> 
> This should not be a problem. You can connect signals and slots across
> thread  boundaries without problems. What specifically is going wrong for
> you? Do you have trouble handing over the QNetworkReply?

Forget it.

QNetworkAccessManager and QNetworkReply are *not* thread-safe. They are 
reentrant only, with the added catch that the QNetworkReply must be used in 
the same thread as the QNetworkAccessManager for at least as long as it's 
still receiving data.

You could try to move it after the finished() signal, but at that point you 
might just do a readAll() and pass the QByteArray in a signal.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140129/735b57ac/attachment.sig>


More information about the Interest mailing list