Don't get stuck on idle when interrupts run.

This was happening when the dispatch thread was disabled.
This commit is contained in:
Unknown W. Brackets 2013-04-06 17:03:39 -07:00
parent 57963a3de3
commit 65ac7389d7
3 changed files with 52 additions and 4 deletions

View file

@ -812,6 +812,37 @@ bool __KernelSwitchOffThread(const char *reason)
return false;
}
bool __KernelSwitchToThread(SceUID threadID, const char *reason)
{
if (!reason)
reason = "switch to thread";
if (currentThread != threadIdleID[0] && currentThread != threadIdleID[1])
{
ERROR_LOG(HLE, "__KernelSwitchToThread used when already on a thread.");
return false;
}
if (currentThread == threadID)
return false;
u32 error;
Thread *t = kernelObjects.Get<Thread>(threadID, error);
if (!t)
ERROR_LOG(HLE, "__KernelSwitchToThread: %x doesn't exist", threadID)
else
{
Thread *current = __GetCurrentThread();
if (current && current->isRunning())
__KernelChangeReadyState(current, threadID, true);
__KernelSwitchContext(t, reason);
return true;
}
return false;
}
void __KernelIdle()
{
CoreTiming::Idle();