[Qt-interest] wget vs. QHttp download

Konrad Rosenbaum konrad at silmor.de
Fri Nov 5 20:17:25 CET 2010


On Friday 05 November 2010, Christian Dähn wrote:
> I personally dislike the massive use and new dependencies to the main
> event loop - till now I found no way to use QNAM in a blocking way -
> like the waitForXxx() calls of QIODevice or QAbstractSocket.

Simply create a local QEventLoop. I use code like this:

QEventLoop myloop;
connect(response,SIGNAL(finished()),&myloop,SLOT(quit()));
connect(response,SIGNAL(error(QNetworkReply::NetworkError)),&myloop,SLOT(quit()));
myloop.exec();

> @Trolls:
> The new QNAM is a cool solutions if I only care about smart API design -
> but in daily life it hast some serious pitfalls - like the performance
> problems caused by many QNAM actions running in massive multithreading
> apps.

QNAM will use the local loop of the thread it was created in. So you simply 
create one instance of QNAM per thread from inside the run() method.

> Did you ever thought about using QNAM in massive multithreading
> environments? Flooding the main eventloop causes my apps to slow down -
> so I have to use non-Qt classes - or to write my own QNAM implementation
> using the QAbstractSockets.

They did. You simply have to use it correctly.


	Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101105/f53f88f9/attachment.bin 


More information about the Qt-interest-old mailing list