From d97c229eaf43e47dc68a2da5bab76aa4f3899ae2 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 28 Apr 2014 23:22:46 -0700 Subject: [PATCH] Fix IsOnSeparateCPUThread(), was always false. Erp, because of detach(). --- Core/CoreTiming.cpp | 2 +- Core/System.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index f4c38684980f..e49283cf65ea 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -71,7 +71,7 @@ Event *eventPool = 0; Event *eventTsPool = 0; int allocatedTsEvents = 0; // Optimization to skip MoveEvents when possible. -volatile u32 hasTsEvents = false; +volatile u32 hasTsEvents = 0; // Downcount has been moved to currentMIPS, to save a couple of clocks in every ARM JIT block // as we can already reach that structure through a register. diff --git a/Core/System.cpp b/Core/System.cpp index 31b2c90157f5..5b421e141593 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -76,6 +76,7 @@ GlobalUIState globalUIState; static CoreParameter coreParameter; static PSPMixer *mixer; static std::thread *cpuThread = NULL; +static std::thread::id cpuThreadID; static recursive_mutex cpuThreadLock; static condition_variable cpuThreadCond; static condition_variable cpuThreadReplyCond; @@ -108,7 +109,7 @@ void Audio_Init() { bool IsOnSeparateCPUThread() { if (cpuThread != NULL) { - return cpuThread->get_id() == std::this_thread::get_id(); + return cpuThreadID == std::this_thread::get_id(); } else { return false; } @@ -336,6 +337,7 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) { XSetThreadProcessor(cpuThread->native_handle(), 2); ResumeThread(cpuThread->native_handle()); #endif + cpuThreadID = cpuThread->get_id(); cpuThread->detach(); } else { CPU_Init(); @@ -411,6 +413,7 @@ void PSP_Shutdown() { CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsShutdown); delete cpuThread; cpuThread = 0; + cpuThreadID = std::thread::id(); } else { CPU_Shutdown(); }