mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-21 17:30:46 +00:00
Windows: Trigger StopThread() on shutdown.
Otherwise, we end up hanging in the loop waiting for emuThreadState to become STOPPED. It actually has, but ThreadFrame() will block until a new frame is queued... while will never happen, because the emuthread has stopped.
This commit is contained in:
parent
3c93eaf164
commit
2bec3bf3ac
@ -32,6 +32,7 @@ public:
|
||||
virtual void ThreadStart() {}
|
||||
virtual bool ThreadFrame() { return true; }
|
||||
virtual void ThreadEnd() {}
|
||||
virtual void StopThread() {}
|
||||
|
||||
virtual Draw::DrawContext *GetDrawContext() = 0;
|
||||
};
|
||||
|
@ -86,6 +86,9 @@ static void EmuThreadFunc(GraphicsContext *graphicsContext) {
|
||||
emuThreadState = (int)EmuThreadState::STOPPED;
|
||||
|
||||
NativeShutdownGraphics();
|
||||
|
||||
// Ask the main thread to stop. This prevents a hang on a race condition.
|
||||
graphicsContext->StopThread();
|
||||
}
|
||||
|
||||
static void EmuThreadStart(GraphicsContext *graphicsContext) {
|
||||
|
@ -432,3 +432,8 @@ bool WindowsGLContext::ThreadFrame() {
|
||||
void WindowsGLContext::ThreadEnd() {
|
||||
renderManager_->ThreadEnd();
|
||||
}
|
||||
|
||||
void WindowsGLContext::StopThread() {
|
||||
renderManager_->WaitUntilQueueIdle();
|
||||
renderManager_->StopThread();
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
void ThreadStart() override;
|
||||
void ThreadEnd() override;
|
||||
bool ThreadFrame() override;
|
||||
void StopThread() override;
|
||||
|
||||
Draw::DrawContext *GetDrawContext() override { return draw_; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user