[Qt-interest] QNetworkAccessManager
Lane Christiansen
lanec42 at gmail.com
Sun Sep 20 01:56:04 CEST 2009
So I've set up a class that connects to and retrieves information from a
remote service. I'm using QNetworkAccessManager, and the get request is
performed inside my class' constructor. My class waits for the finished signal
from QNetworkReply, and then emits its own "finished" signal. If I declare an
instance of my class, and _then_ connect my class' finished signal, could
there be a race condition? It's seems like QNetworkAccessManager isn't
blocking my program, so I'm worried that if the remote service responds
quickly enough, the signals/slots won't be connected yet, and I won't know
that the request has finished.
That probably made no sense at all, so here's some pseudocode:
1 MY CLASS:
2 constructor(params)
3 {
4 perform get request
5 connect(reply, SIGNAL(finished()), this, SLOT(finished()))
6 }
7 finished()
8 {
9 emit done()
10 }
11
12 IMPLEMENTATION:
13 MyClass *foo = new MyClass(params)
14 connect(foo, SIGNAL(done), this, SLOT(done))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090919/e8ab2684/attachment.bin
More information about the Qt-interest-old
mailing list