mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-16 07:50:28 +02:00
Fix another race condition.
If EVENT_FINISH is received, but coreState is still CORE_RUNNING and the thread is still enabled, it would hang. Makes more sense to wait for events before processing them anyhow...
This commit is contained in:
1 parent
a5b27b659c
commit
effcee475b
1 file changed
+4
-5
@@ -75,6 +75,10 @@ struct ThreadEventQueue : public B {
|
||||
eventsHaveRun_ = true;
|
||||
|
||||
do {
|
||||
if (!HasEvents()) {
|
||||
eventsWait_.wait(eventsLock_);
|
||||
}
|
||||
|
||||
for (Event ev = GetNextEvent(); EventType(ev) != EVENT_INVALID; ev = GetNextEvent()) {
|
||||
eventsLock_.unlock();
|
||||
switch (EventType(ev)) {
|
||||
@@ -96,11 +100,6 @@ struct ThreadEventQueue : public B {
|
||||
if (ShouldExitEventLoop() || !threadEnabled_) {
|
||||
break;
|
||||
}
|
||||
|
||||
// coreState changes won't wake us, so recheck periodically.
|
||||
if (!HasEvents()) {
|
||||
eventsWait_.wait(eventsLock_);
|
||||
}
|
||||
} 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