NETWORKING: Add CurlRequest::wait()

This commit is contained in:
Alexander Tkachev 2019-11-02 04:49:50 +07:00 committed by Eugene Sandulenko
parent 2acb8e2215
commit bc63abd3e1
2 changed files with 9 additions and 0 deletions

View File

@ -148,4 +148,10 @@ NetworkReadStreamResponse CurlRequest::execute() {
const NetworkReadStream *CurlRequest::getNetworkReadStream() const { return _stream; }
void CurlRequest::wait(int spinlockDelay) {
while (state() == Networking::PROCESSING) {
g_system->delayMillis(spinlockDelay);
}
}
} // End of namespace Networking

View File

@ -93,6 +93,9 @@ public:
/** Returns Request's NetworkReadStream. */
const NetworkReadStream *getNetworkReadStream() const;
/** Waits for Request to be processed. Should be called after Request is put into ConnMan. */
void wait(int spinlockDelay = 5);
};
} // End of namespace Networking