Shutdown issues: the legend continues.

If the gpu was slow (softgpu for example), it might still be accessing
memory.  Need to let it wake, and ignoring coreState too.
This commit is contained in:
Unknown W. Brackets 2013-10-13 09:35:02 -07:00
parent 9cbb1cb8d3
commit 479a9801d4
3 changed files with 8 additions and 3 deletions

View file

@ -257,6 +257,10 @@ void CPU_RunLoop() {
coreState = CORE_POWERDOWN;
}
// Let's make sure the gpu has already cleaned up before we start freeing memory.
gpu->FinishEventLoop();
gpu->SyncThread(true);
CPU_Shutdown();
CPU_SetState(CPU_THREAD_NOT_RUNNING);
}

View file

@ -89,7 +89,8 @@ struct ThreadEventQueue : public B {
} while (CoreTiming::GetTicks() < globalticks);
}
void SyncThread() {
// Force ignores coreState.
void SyncThread(bool force = false) {
if (!threadEnabled_) {
return;
}
@ -98,7 +99,7 @@ struct ThreadEventQueue : public B {
// While processing the last event, HasEvents() will be false even while not done.
// So we schedule a nothing event and wait for that to finish.
ScheduleEvent(EVENT_SYNC);
while (HasEvents() && coreState == CORE_RUNNING) {
while (HasEvents() && (force || coreState == CORE_RUNNING)) {
eventsDrain_.wait_for(eventsLock_, 1);
}
}

View file

@ -231,7 +231,7 @@ public:
virtual void DeviceLost() = 0;
virtual void ReapplyGfxState() = 0;
virtual void SyncThread() = 0;
virtual void SyncThread(bool force = false) = 0;
virtual u64 GetTickEstimate() = 0;
virtual void DoState(PointerWrap &p) = 0;