[Development] QtNetwork changes from QtDD SF 2011

Jeff Mitchell qt at jefferai.org
Tue Dec 6 16:06:26 CET 2011


On 12/05/2011 06:32 PM, Thiago Macieira wrote:
> QNAM *is* still a QObject, and so are the cache and cookie jars. They are 
> perfectly well attached to one thread. So we could still do cookie-jar and 
> cache access from that same thread, with some cross-thread mechanisms.
> 
> The cookies should not suffer any performance hit, since they are quite small 
> and limited in use (get them prior to sending the request, save them back 
> after getting the reply).
> 
> The cache, however, could be an issue. Imagine I do a get() from an auxiliary 
> thread, one that the QNAM and the cache are not affined to. The implementation 
> would need to read from the cache in one thread and make the data available to 
> the user, in the QNetworkReply, in another thread.
> 
> This would, however, make a "clean" solution.

I guess what's important isn't really that it's *actually* thread-safe;
what's important is that it *appears to be* thread-safe from the
perspective of potential clients, which means that functions like get()
need to behave properly, and we need to be able to do e.g.
QNAM::setApplicationNetworkAccessManager and expect that it works across
threads.

--Jeff



More information about the Development mailing list