mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
GE Debugger: Prevent hang on shutdown.
Since we're blocking the Emu thread, we can't use a hook from the Emu thread to wake up. The change to lifecycle callbacks caused this.
This commit is contained in:
parent
6c494c3849
commit
0ed2c03350
@ -54,7 +54,8 @@ static std::condition_variable m_InactiveCond;
|
|||||||
static std::mutex m_hInactiveMutex;
|
static std::mutex m_hInactiveMutex;
|
||||||
static bool singleStepPending = false;
|
static bool singleStepPending = false;
|
||||||
static int steppingCounter = 0;
|
static int steppingCounter = 0;
|
||||||
static std::set<CoreLifecycleFunc> shutdownFuncs;
|
static std::set<CoreLifecycleFunc> lifecycleFuncs;
|
||||||
|
static std::set<CoreStopRequestFunc> stopFuncs;
|
||||||
static bool windowHidden = false;
|
static bool windowHidden = false;
|
||||||
static double lastActivity = 0.0;
|
static double lastActivity = 0.0;
|
||||||
static double lastKeepAwake = 0.0;
|
static double lastKeepAwake = 0.0;
|
||||||
@ -76,17 +77,24 @@ void Core_NotifyActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Core_ListenLifecycle(CoreLifecycleFunc func) {
|
void Core_ListenLifecycle(CoreLifecycleFunc func) {
|
||||||
shutdownFuncs.insert(func);
|
lifecycleFuncs.insert(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core_NotifyLifecycle(CoreLifecycle stage) {
|
void Core_NotifyLifecycle(CoreLifecycle stage) {
|
||||||
for (auto it = shutdownFuncs.begin(); it != shutdownFuncs.end(); ++it) {
|
for (auto func : lifecycleFuncs) {
|
||||||
(*it)(stage);
|
func(stage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core_ListenStopRequest(CoreStopRequestFunc func) {
|
||||||
|
stopFuncs.insert(func);
|
||||||
|
}
|
||||||
|
|
||||||
void Core_Stop() {
|
void Core_Stop() {
|
||||||
Core_UpdateState(CORE_POWERDOWN);
|
Core_UpdateState(CORE_POWERDOWN);
|
||||||
|
for (auto func : stopFuncs) {
|
||||||
|
func();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core_IsStepping() {
|
bool Core_IsStepping() {
|
||||||
|
@ -51,10 +51,15 @@ enum class CoreLifecycle {
|
|||||||
MEMORY_REINITED,
|
MEMORY_REINITED,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Callback is called on the Emu thread.
|
||||||
typedef void (* CoreLifecycleFunc)(CoreLifecycle stage);
|
typedef void (* CoreLifecycleFunc)(CoreLifecycle stage);
|
||||||
void Core_ListenLifecycle(CoreLifecycleFunc func);
|
void Core_ListenLifecycle(CoreLifecycleFunc func);
|
||||||
void Core_NotifyLifecycle(CoreLifecycle stage);
|
void Core_NotifyLifecycle(CoreLifecycle stage);
|
||||||
|
|
||||||
|
// Callback is executed on requesting thread.
|
||||||
|
typedef void (* CoreStopRequestFunc)();
|
||||||
|
void Core_ListenStopRequest(CoreStopRequestFunc callback);
|
||||||
|
|
||||||
bool Core_IsStepping();
|
bool Core_IsStepping();
|
||||||
|
|
||||||
bool Core_IsActive();
|
bool Core_IsActive();
|
||||||
|
@ -197,12 +197,10 @@ void ResumeFromStepping() {
|
|||||||
SetPauseAction(PAUSE_CONTINUE, false);
|
SetPauseAction(PAUSE_CONTINUE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForceUnpause(CoreLifecycle stage) {
|
void ForceUnpause() {
|
||||||
if (stage == CoreLifecycle::STOPPING) {
|
SetPauseAction(PAUSE_CONTINUE, false);
|
||||||
SetPauseAction(PAUSE_CONTINUE, false);
|
actionComplete = true;
|
||||||
actionComplete = true;
|
actionWait.notify_all();
|
||||||
actionWait.notify_all();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -38,5 +38,5 @@ namespace GPUStepping {
|
|||||||
bool GPU_SetCmdValue(u32 op);
|
bool GPU_SetCmdValue(u32 op);
|
||||||
|
|
||||||
void ResumeFromStepping();
|
void ResumeFromStepping();
|
||||||
void ForceUnpause(CoreLifecycle stage);
|
void ForceUnpause();
|
||||||
};
|
};
|
||||||
|
@ -67,7 +67,7 @@ void CGEDebugger::Init() {
|
|||||||
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
||||||
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent) {
|
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent) {
|
||||||
GPUBreakpoints::Init();
|
GPUBreakpoints::Init();
|
||||||
Core_ListenLifecycle(ForceUnpause);
|
Core_ListenStopRequest(ForceUnpause);
|
||||||
|
|
||||||
// minimum size = a little more than the default
|
// minimum size = a little more than the default
|
||||||
RECT windowRect;
|
RECT windowRect;
|
||||||
|
Loading…
Reference in New Issue
Block a user