Skip to content

Commit

Permalink
Merge pull request #1138 from unknownbrackets/scheduling
Browse files Browse the repository at this point in the history
Fix scheduling when starting a thread + potential crash
  • Loading branch information
hrydgard committed Mar 31, 2013
2 parents 36f15d5 + 72921e0 commit 086fd24
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Core/HLE/sceKernelThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ class MipsCallManager {
return id;
}
MipsCall *get(u32 id) {
return calls_[id];
auto iter = calls_.find(id);
if (iter == calls_.end())
return NULL;
return iter->second;
}
MipsCall *pop(u32 id) {
MipsCall *temp = calls_[id];
Expand Down Expand Up @@ -1614,7 +1617,9 @@ int sceKernelStartThread(SceUID threadToStartID, u32 argSize, u32 argBlockPtr)
// TODO: Maybe this happens even for worse-priority started threads?
dispatchEnabled = true;

__KernelChangeReadyState(currentThread, true);
if (cur && cur->isRunning())
cur->nt.status &= ~THREADSTATUS_RUNNING;
__KernelChangeReadyState(cur, currentThread, true);
hleReSchedule("thread started");
}
else if (!dispatchEnabled)
Expand Down

0 comments on commit 086fd24

Please sign in to comment.