mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 01:29:41 +01:00
Fix issues on win32 with multithreading.
We weren't properly rechecking based on spurious wakeups (which technically can happen on x64 too.)
This commit is contained in:
1 parent
ea9bad322f
commit
b1b2c91eb3
1 file changed
+5
-6
@@ -75,9 +75,13 @@ struct ThreadEventQueue : public B {
|
||||
eventsHaveRun_ = true;
|
||||
|
||||
do {
|
||||
if (!HasEvents()) {
|
||||
while (!HasEvents() && !ShouldExitEventLoop() && threadEnabled_) {
|
||||
eventsWait_.wait(eventsLock_);
|
||||
}
|
||||
// Quit the loop if the queue is drained and coreState has tripped, or threading is disabled.
|
||||
if (!HasEvents()) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (Event ev = GetNextEvent(); EventType(ev) != EVENT_INVALID; ev = GetNextEvent()) {
|
||||
eventsLock_.unlock();
|
||||
@@ -95,11 +99,6 @@ struct ThreadEventQueue : public B {
|
||||
}
|
||||
eventsLock_.lock();
|
||||
}
|
||||
|
||||
// Quit the loop if the queue is drained and coreState has tripped, or threading is disabled.
|
||||
if (ShouldExitEventLoop() || !threadEnabled_) {
|
||||
break;
|
||||
}
|
||||
} while (CoreTiming::GetTicks() < globalticks);
|
||||
|
||||
// This will force the waiter to check coreState, even if we didn't actually drain.
|
||||
|
||||
Reference in new issue
Block a user