Skip to content

Commit

Permalink
Fix IsOnSeparateCPUThread(), was always false.
Browse files Browse the repository at this point in the history
Erp, because of detach().
  • Loading branch information
unknownbrackets committed Apr 29, 2014
1 parent f052778 commit d97c229
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Core/CoreTiming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion Core/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -411,6 +413,7 @@ void PSP_Shutdown() {
CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsShutdown);
delete cpuThread;
cpuThread = 0;
cpuThreadID = std::thread::id();
} else {
CPU_Shutdown();
}
Expand Down

0 comments on commit d97c229

Please sign in to comment.