mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Fix a potential race condition
This commit is contained in:
@@ -46,6 +46,7 @@ public:
|
||||
if (callback_) {
|
||||
callback_(*this);
|
||||
}
|
||||
hasRunCallback_ = true;
|
||||
}
|
||||
|
||||
virtual void Start() = 0;
|
||||
@@ -54,6 +55,8 @@ public:
|
||||
virtual bool Done() = 0;
|
||||
virtual bool Failed() const = 0;
|
||||
|
||||
virtual bool HasRunCallback() { return Done() && hasRunCallback_; }
|
||||
|
||||
// Returns 1.0 when done. That one value can be compared exactly - or just use Done().
|
||||
float Progress() const { return progress_.progress; }
|
||||
float SpeedKBps() const { return progress_.kBps; }
|
||||
@@ -87,6 +90,7 @@ protected:
|
||||
Buffer buffer_;
|
||||
bool cancelled_ = false;
|
||||
int resultCode_ = 0;
|
||||
bool hasRunCallback_ = false;
|
||||
std::vector<std::string> responseHeaders_;
|
||||
|
||||
net::RequestProgress progress_;
|
||||
|
||||
@@ -213,7 +213,8 @@ void AdhocLoadServerList(bool sync) {
|
||||
do {
|
||||
sleep_ms(10, "waiting-for-adhoc-server-list");
|
||||
g_DownloadManager.Update();
|
||||
} while (!dl->Done());
|
||||
} while (!dl->HasRunCallback());
|
||||
dl.reset();
|
||||
}
|
||||
g_serverListLoaded = true;
|
||||
} else if (!g_Config.sAdhocServerListUrl.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user