I see your point now, thanks. Indeed, _http member variable lives in the main thread when I call a.start(). Run method of the "a" instance uses _http once and then exits with "exec()", leaving event loop alive.

I will rearrange the code by the scheme below. Do you consider it to be a proper usage of event loop and QNAM?

Qt Code:
  1. class myClass : public QThread
  2. {
  3. public:
  4. myClass ()
  5. {
  6. connect(this, SIGNAL(doComm()), this, SLOT(onDoComm()), Qt::Queued);
  7. }
  8. void run() { exec(); }
  9. void startComm() {emit doComm();}
  10. signals:
  11. void doComm();
  12. slots:
  13. void onDoComm() {_http.post(...);};
  14. void isFinished(QNetworReply* r) {r->deleteLater(); emit doComm();}
  15. private:
  16. QNAM _http;
  17. };
  18.  
  19. main
  20. {
  21. myClass a;
  22. a.start();
  23. a.startComm();
  24.  
  25. int i;
  26. std::cin >> i;
  27. }
To copy to clipboard, switch view to plain text mode