[Qt-interest] QNetworkAccessManager in GUI thread

Thiago Macieira thiago at kde.org
Thu Jan 21 19:33:26 CET 2010


Em Quinta-feira 21 Janeiro 2010, às 12:33:14, Nitin Mahajan escreveu:
> Hello,
> 
> In a GUI application like Demo Browser, I have a QNetworkAccessManager
> object say "A" created in the GUI thread itself.
> 
> I want to do the actual file download in a separate thread, so that my
> GUI/mouse cursor does not freeze. Can I create a new QNetworkAccessManager
> "B" in the new thread and set the cookiejar and proxy from "A" and still
> download?

No.

QNetworkAccessManager, all its QNetworkReply objects, QNetworkCookieJar, 
QAbstractNetworkCache, etc., must all live in the same thread.

> While doing the download in the GUI thread itself I can see the mouse
> cursor freezing, even though the replies of the requests sent through
> NetworkAccessManager arrive asynchronously. Whether Network acccess
> manager does some operation which is still Blocking?

Nothing is blocking. Everything is asynchronous.

My guess is that your device is just that much underpowered. It would be 
interesting to profile the application and find out where the bottleneck is.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100121/01ab0ca2/attachment.bin 


More information about the Qt-interest-old mailing list