QNetworkAccessManager manager; QEventLoop loop; QObject::connect(&manager, QOverload::of(&QNetworkAccessManager::finished), &loop, &QEventLoop::quit); ... loop.exec();
As for the timeout can call QTimer::singleShot(3000, &loop, &QEventLoop::quit);
PS: you should generally avoid locking, and process all slots in the class. Note that one instance of QNetworkAccessManager is limited to four simultaneous connections.