From c9b037815f728ea294aec17f5f6cd62d58e58ef8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 28 Jan 2014 22:10:28 -0800 Subject: [PATCH] Reschedule instead of switching to delayed threads. This will hopefully take care of #5263, and might fix other issues too. If a thread goes into a wait, it may reschedule right into an interrupt. In this case, it would've been switched back to, and woken up early. --- Core/HLE/sceKernelThread.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index be4159c09e..1235c8230f 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1361,8 +1361,11 @@ bool __KernelSwitchToThread(SceUID threadID, const char *reason) u32 error; Thread *t = kernelObjects.Get(threadID, error); if (!t) - ERROR_LOG(SCEKERNEL, "__KernelSwitchToThread: %x doesn't exist", threadID) - else + { + ERROR_LOG_REPORT(SCEKERNEL, "__KernelSwitchToThread: %x doesn't exist", threadID); + hleReSchedule("switch to deleted thread"); + } + else if (t->isReady() || t->isRunning()) { Thread *current = __GetCurrentThread(); if (current && current->isRunning()) @@ -1371,6 +1374,10 @@ bool __KernelSwitchToThread(SceUID threadID, const char *reason) __KernelSwitchContext(t, reason); return true; } + else + { + hleReSchedule("switch to waiting thread"); + } return false; }