mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 10:43:44 +01:00
Fix misuses of cond.wait (should return true when you want to stop waiting!)
This commit is contained in:
1 parent
5b20ace502
commit
bde54ccdc0
3 files changed
+13
-8
No files matched your search
@@ -14,7 +14,7 @@ public:
|
||||
void Wait() override {
|
||||
if (!triggered_) {
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
cond_.wait(lock, [&] { return !triggered_; });
|
||||
cond_.wait(lock, [&] { return triggered_.load(); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
if (us == 0)
|
||||
return false;
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
cond_.wait_for(lock, std::chrono::microseconds(us), [&] { return !triggered_; });
|
||||
cond_.wait_for(lock, std::chrono::microseconds(us), [&] { return triggered_.load(); });
|
||||
}
|
||||
return triggered_;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user