From cd8e0e675c953bf1cb24b46e7602c1c31ad51605 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 20 Mar 2013 00:06:19 -0700 Subject: [PATCH] Small optimization to sceKernelRotateThreadReadyQueue(). --- Core/HLE/sceKernelThread.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 504df10208..104d076bc2 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1754,20 +1754,21 @@ int sceKernelRotateThreadReadyQueue(int priority) if (priority <= 0x07 || priority > 0x77) return SCE_KERNEL_ERROR_ILLEGAL_PRIORITY; - if (!threadReadyQueue[priority].empty()) + auto &queue = threadReadyQueue[priority]; + if (!queue.empty()) { // In other words, yield to everyone else. if (cur->nt.currentPriority == priority) { - threadReadyQueue[priority].push_back(currentThread); + queue.push_back(currentThread); cur->nt.status = THREADSTATUS_READY; } // Yield the next thread of this priority to all other threads of same priority. else if (threadReadyQueue[priority].size() > 1) { SceUID first = threadReadyQueue[priority].front(); - threadReadyQueue[priority].pop_front(); - threadReadyQueue[priority].push_back(first); + queue.pop_front(); + queue.push_back(first); } hleReSchedule("rotatethreadreadyqueue");