[Interest] QNetworkAccessManager in a command line, non-eventloop application

Thiago Macieira thiago.macieira at intel.com
Fri Jan 18 10:50:34 CET 2013


On sexta-feira, 18 de janeiro de 2013 01.49.35, Scott Aron Bloom wrote:
> I don't want to block

Yet you're describing exactly a blocking situation:

> I would like a background thread and have the request run in there, using
> the QThreads event loop.

The background thread runs an event loop, sure, but what is the main thread 
doing in the meantime? Since it doesn't have an event loop, it cannot receive 
events. The only synchronisation mechanisms left are QWaitCondition and 
QSemaphore, which means the main thread must block waiting for the background 
thread to finish the operation.

You really don't have a choice besides those two. Network access is not 
instantaneous. You must either use the event loop or you need to block.

Choose one.

-- 
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/20130118/8a4f22e9/attachment.sig>


More information about the Interest mailing list