From 8bae2e09647e77dbab4a005223c17509a8191b1a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 1 Dec 2012 14:36:56 -0800 Subject: [PATCH] Cancel wakeup events when a thread ends. --- Core/HLE/sceKernelThread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index d4f2919b64..823e9330aa 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -265,6 +265,7 @@ void __KernelExecuteMipsCallOnCurrentThread(int callId); int g_inCbCount = 0; Thread *__KernelCreateThread(SceUID &id, SceUID moduleID, const char *name, u32 entryPoint, u32 priority, int stacksize, u32 attr); +void __KernelCancelWakeup(SceUID threadID); ////////////////////////////////////////////////////////////////////////// //STATE BEGIN @@ -344,6 +345,8 @@ void __KernelThreadingInit() __KernelCreateThread(threadIdleID[0], 0, "idle0", idleThreadHackAddr, 0x7f, 4096, PSP_THREAD_ATTR_KERNEL); __KernelCreateThread(threadIdleID[1], 0, "idle1", idleThreadHackAddr, 0x7f, 4096, PSP_THREAD_ATTR_KERNEL); // These idle threads are later started in LoadExec, which calls __KernelStartIdleThreads below. + + __KernelListenThreadEnd(__KernelCancelWakeup); } void __KernelListenThreadEnd(ThreadCallback callback) @@ -683,6 +686,11 @@ void __KernelScheduleWakeup(SceUID threadID, int usFromNow) CoreTiming::ScheduleEvent(usToCycles(usFromNow), eventScheduledWakeup, threadID); } +void __KernelCancelWakeup(SceUID threadID) +{ + CoreTiming::UnscheduleEvent(eventScheduledWakeup, threadID); +} + void __KernelRemoveFromThreadQueue(Thread *t) { for (size_t i = 0; i < threadqueue.size(); i++)