From 7044fafe84a6275fbd2f8a9d2724a245243332c4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 8 Dec 2012 19:13:33 -0800 Subject: [PATCH] Always run callbacks when rescheduling. Not just when rescheduling because of a *CB() func. --- Core/HLE/sceKernelThread.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 0b05c6dc29..fb795321b5 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -754,20 +754,27 @@ Thread *__KernelNextThread() { void __KernelReSchedule(const char *reason) { - // cancel rescheduling when in interrupt or callback, otherwise everything will be fucked up - if (__IsInInterrupt() || __KernelInCallback()) - { - reason = "In Interrupt Or Callback"; - return; - } + // cancel rescheduling when in interrupt or callback, otherwise everything will be fucked up + if (__IsInInterrupt() || __KernelInCallback()) + { + reason = "In Interrupt Or Callback"; + return; + } - // Execute any pending events while we're doing scheduling. - CoreTiming::Advance(); - if (__IsInInterrupt() || __KernelInCallback()) - { - reason = "In Interrupt Or Callback"; - return; - } + // This may get us running a callback, don't reschedule out of it. + if (__KernelCheckCallbacks()) + { + reason = "Began interrupt or callback."; + return; + } + + // Execute any pending events while we're doing scheduling. + CoreTiming::Advance(); + if (__IsInInterrupt() || __KernelInCallback()) + { + reason = "In Interrupt Or Callback"; + return; + } retry: Thread *nextThread = __KernelNextThread(); @@ -793,7 +800,6 @@ void __KernelReSchedule(bool doCallbacks, const char *reason) { if (thread) thread->isProcessingCallbacks = doCallbacks; - __KernelCheckCallbacks(); } __KernelReSchedule(reason); if (doCallbacks && thread == currentThread) {