mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 17:53:42 +01:00
Ensure interrupts don't run on real threads.
If a thread waits on a sema, and an interrupt (such as an alarm) happens, and the interrupt signals or deletes the sema, it needs to return the value correctly. For callbacks, it's injected, since they run on thread. But interrupts aren't supposed to run on thread anyway, so this switches to idle.
This commit is contained in:
1 parent
c75f37fdb6
commit
35a38ac6b9
3 files changed
+32
No files matched your search
@@ -395,6 +395,30 @@ void __KernelStartIdleThreads()
|
||||
}
|
||||
}
|
||||
|
||||
bool __KernelSwitchOffThread(const char *reason)
|
||||
{
|
||||
if (!reason)
|
||||
reason = "switch off thread";
|
||||
|
||||
SceUID threadID = currentThread->GetUID();
|
||||
|
||||
if (threadID != threadIdleID[0] && threadID != threadIdleID[1])
|
||||
{
|
||||
u32 error;
|
||||
// Idle 0 chosen entirely arbitrarily.
|
||||
Thread *t = kernelObjects.Get<Thread>(threadIdleID[0], error);
|
||||
if (t)
|
||||
{
|
||||
__KernelSwitchContext(t, reason);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
ERROR_LOG(HLE, "Unable to switch to idle thread.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void __KernelIdle()
|
||||
{
|
||||
CoreTiming::Idle();
|
||||
|
||||
Reference in new issue
Block a user